diff options
author | Johan Hovold <johan@kernel.org> | 2017-03-16 18:37:01 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-30 07:41:23 (GMT) |
commit | 9f6a8dca9874ca923dbb253a96e9f4a537643b9d (patch) | |
tree | 3ae71f2e18c04ca01f37065696c7172cb5303959 /drivers/input | |
parent | d9a3e6424e6147d6e9ae16c845e596516ddf807a (diff) | |
download | linux-9f6a8dca9874ca923dbb253a96e9f4a537643b9d.tar.xz |
Input: yealink - validate number of endpoints before using them
commit 5cc4a1a9f5c179795c8a1f2b0f4361829d6a070e upstream.
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/yealink.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 79c964c..6e7ff95 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; |