Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ecfe51b authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

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: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 73d8ef76
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);