summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 11:41:55 -0700
committerSasha Levin <alexander.levin@verizon.com>2017-05-17 15:07:02 -0400
commit84a91ce021050bd60f41fed78f8ffa83712c4db1 (patch)
tree4520ea850b52a75f44b6a710a6a1e625c11f13c6 /drivers/input
parentf1ba9cf0277683f9067f50244f676117702faf3e (diff)
Input: kbtab - validate number of endpoints before using them
[ Upstream commit cb1b494663e037253337623bf1ef2df727883cb7 ] 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> Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
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)