Skip to content

Commit 6ecfe51

Browse files
committed
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>
1 parent 73d8ef7 commit 6ecfe51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/input/input.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,12 @@ int input_register_device(struct input_dev *dev)
20912091
const char *path;
20922092
int error;
20932093

2094+
if (test_bit(EV_ABS, dev->evbit) && !dev->absinfo) {
2095+
dev_err(&dev->dev,
2096+
"Absolute device without dev->absinfo, refusing to register\n");
2097+
return -EINVAL;
2098+
}
2099+
20942100
if (dev->devres_managed) {
20952101
devres = devres_alloc(devm_input_device_unregister,
20962102
sizeof(struct input_devres), GFP_KERNEL);

0 commit comments

Comments
 (0)