]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.10.7/input-hanwang-validate-number-of-endpoints-before-using-them.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.10.7 / input-hanwang-validate-number-of-endpoints-before-using-them.patch
CommitLineData
90594201
GKH
1From ba340d7b83703768ce566f53f857543359aa1b98 Mon Sep 17 00:00:00 2001
2From: Johan Hovold <johan@kernel.org>
3Date: Thu, 16 Mar 2017 11:39:29 -0700
4Subject: Input: hanwang - validate number of endpoints before using them
5
6From: Johan Hovold <johan@kernel.org>
7
8commit ba340d7b83703768ce566f53f857543359aa1b98 upstream.
9
10Make sure to check the number of endpoints to avoid dereferencing a
11NULL-pointer should a malicious device lack endpoints.
12
13Fixes: bba5394ad3bd ("Input: add support for Hanwang tablets")
14Signed-off-by: Johan Hovold <johan@kernel.org>
15Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
16Signed-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) {