diff options
| author | Johan Hovold <johan@kernel.org> | 2017-03-16 11:37:01 -0700 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-06-17 15:54:14 +0200 |
| commit | 6f7921c1b661ad40ce9903d3774853b736251638 (patch) | |
| tree | 107700788f7cbab2dad7fd20f7e32b00a6f4b009 /drivers/input | |
| parent | 5b4b04c5ff6a84431e41113ed3479ad302ebae09 (diff) | |
| download | android_kernel_m2note-6f7921c1b661ad40ce9903d3774853b736251638.tar.gz | |
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: Willy Tarreau <w@1wt.eu>
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 285a5bd6c..3b6fdb389 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -876,6 +876,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; |
