summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-02-01 02:09:08 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-02-01 21:33:21 +0300
commit6ecfe51b4082e7cff12609f97daa052ae04b61fd (patch)
tree46c4182f9166fc447c462eb5bdb52a3cb4d4837a /drivers/input
parent73d8ef76006b649f9c272cb4473039e25fcc9908 (diff)
downloadlinux-6ecfe51b4082e7cff12609f97daa052ae04b61fd.tar.xz
Input: refuse to register absolute devices without absinfo
If device is supposed to send absolute events (i.e. EV_ABS bit is set in dev->evbit) but dev->absinfo is not allocated, then the driver has done something wrong, and we should not register such device. Otherwise we'll crash later, when driver tries to send absolute event. Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 6a75bb08b9ff..067d648028a2 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2091,6 +2091,12 @@ int input_register_device(struct input_dev *dev)
const char *path;
int error;
+ if (test_bit(EV_ABS, dev->evbit) && !dev->absinfo) {
+ dev_err(&dev->dev,
+ "Absolute device without dev->absinfo, refusing to register\n");
+ return -EINVAL;
+ }
+
if (dev->devres_managed) {
devres = devres_alloc(devm_input_device_unregister,
sizeof(struct input_devres), GFP_KERNEL);