aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 11:37:01 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-16 13:56:52 -0700
commit5cc4a1a9f5c179795c8a1f2b0f4361829d6a070e (patch)
treedfcd2778ef9438b8533d646674fea60aa9a7c765 /drivers/input/misc
parentInput: ims-pcu - validate number of endpoints before using them (diff)
downloadlinux-dev-5cc4a1a9f5c179795c8a1f2b0f4361829d6a070e.tar.xz
linux-dev-5cc4a1a9f5c179795c8a1f2b0f4361829d6a070e.zip
Input: yealink - validate number of endpoints before using them
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints. Fixes: aca951a22a1d ("[PATCH] input-driver-yealink-P1K-usb-phone") Signed-off-by: Johan Hovold <johan@kernel.org> Cc: stable@vger.kernel.org # 2.6.14 Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/yealink.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 79c964c075f1..6e7ff9561d92 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
int ret, pipe, i;
interface = intf->cur_altsetting;
+
+ if (interface->desc.bNumEndpoints < 1)
+ return -ENODEV;
+
endpoint = &interface->endpoint[0].desc;
if (!usb_endpoint_is_int_in(endpoint))
return -ENODEV;