summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 11:41:55 -0700
committerBen Hutchings <ben@decadent.org.uk>2017-07-18 18:38:34 +0100
commit3ae9936940b17d47899ea78188c68442dcc92395 (patch)
treef907e946cd003ea11d7844c7ccd7aac2fe3dca6d /drivers/input
parent5a2a5e6c28b145bc90652899c0b9f34404caee75 (diff)
downloadlinux-3ae9936940b17d47899ea78188c68442dcc92395.tar.gz
linux-3ae9936940b17d47899ea78188c68442dcc92395.tar.bz2
linux-3ae9936940b17d47899ea78188c68442dcc92395.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: Ben Hutchings <ben@decadent.org.uk>
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 290f4e57b589..3b67fb865346 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -117,6 +117,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)