summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 11:41:55 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-22 07:15:04 +0200
commitc201e0b44896488c1b02515f08ece02bc106cb8d (patch)
treeb45a4c84506499e07f64394ecfc3870a064a901a /drivers/input
parentd1f5902b6bf1dff1efa02ca799a89917b8237f07 (diff)
downloadlinux-stable-c201e0b44896488c1b02515f08ece02bc106cb8d.tar.gz
linux-stable-c201e0b44896488c1b02515f08ece02bc106cb8d.tar.bz2
linux-stable-c201e0b44896488c1b02515f08ece02bc106cb8d.zip
Input: kbtab - validate number of endpoints before using them
commit cb1b494663e037253337623bf1ef2df727883cb7 upstream. Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints. 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/tablet/kbtab.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index d2ac7c2b5b82..2812f9236b7d 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
struct input_dev *input_dev;
int error = -ENOMEM;
+ if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+ return -ENODEV;
+
kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbtab || !input_dev)