]>
Commit | Line | Data |
---|---|---|
90594201 GKH |
1 | From ba340d7b83703768ce566f53f857543359aa1b98 Mon Sep 17 00:00:00 2001 |
2 | From: Johan Hovold <johan@kernel.org> | |
3 | Date: Thu, 16 Mar 2017 11:39:29 -0700 | |
4 | Subject: Input: hanwang - validate number of endpoints before using them | |
5 | ||
6 | From: Johan Hovold <johan@kernel.org> | |
7 | ||
8 | commit ba340d7b83703768ce566f53f857543359aa1b98 upstream. | |
9 | ||
10 | Make sure to check the number of endpoints to avoid dereferencing a | |
11 | NULL-pointer should a malicious device lack endpoints. | |
12 | ||
13 | Fixes: bba5394ad3bd ("Input: add support for Hanwang tablets") | |
14 | Signed-off-by: Johan Hovold <johan@kernel.org> | |
15 | Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> | |
16 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
17 | ||
18 | --- | |
19 | drivers/input/tablet/hanwang.c | 3 +++ | |
20 | 1 file changed, 3 insertions(+) | |
21 | ||
22 | --- a/drivers/input/tablet/hanwang.c | |
23 | +++ b/drivers/input/tablet/hanwang.c | |
24 | @@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_inte | |
25 | int error; | |
26 | int i; | |
27 | ||
28 | + if (intf->cur_altsetting->desc.bNumEndpoints < 1) | |
29 | + return -ENODEV; | |
30 | + | |
31 | hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL); | |
32 | input_dev = input_allocate_device(); | |
33 | if (!hanwang || !input_dev) { |