Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599281

[PATCH 3/7] Input: ims-pcu - fix NULL-deref at probe

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/7] Input: ims-pcu - fix NULL-deref at probe
Date 2017-03-13 13:40 +0100
Message-ID <tkxqy-uQ-9@gated-at.bofh.it> (permalink)
References <tkxqx-uQ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack control-interface endpoints.

Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
Cc: stable <stable@vger.kernel.org>	# 3.10
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/input/misc/ims-pcu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 9c0ea36913b4..f4e8fbec6a94 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 		return -EINVAL;
 
 	alt = pcu->ctrl_intf->cur_altsetting;
+
+	if (alt->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	pcu->ep_ctrl = &alt->endpoint[0].desc;
 	pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
 
-- 
2.12.0

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3/7] Input: ims-pcu - fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 13:40 +0100

csiph-web