diff options
| author | Johan Hovold <johan@kernel.org> | 2017-03-16 14:37:01 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-30 03:41:23 -0400 |
| commit | 9f6a8dca9874ca923dbb253a96e9f4a537643b9d (patch) | |
| tree | 3ae71f2e18c04ca01f37065696c7172cb5303959 /drivers/input | |
| parent | d9a3e6424e6147d6e9ae16c845e596516ddf807a (diff) | |
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 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) | |||
| 875 | int ret, pipe, i; | 875 | int ret, pipe, i; |
| 876 | 876 | ||
| 877 | interface = intf->cur_altsetting; | 877 | interface = intf->cur_altsetting; |
| 878 | |||
| 879 | if (interface->desc.bNumEndpoints < 1) | ||
| 880 | return -ENODEV; | ||
| 881 | |||
| 878 | endpoint = &interface->endpoint[0].desc; | 882 | endpoint = &interface->endpoint[0].desc; |
| 879 | if (!usb_endpoint_is_int_in(endpoint)) | 883 | if (!usb_endpoint_is_int_in(endpoint)) |
| 880 | return -ENODEV; | 884 | return -ENODEV; |
