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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/input.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -2095,6 +2095,12 @@ int input_register_device(struct input_dev *dev)constchar*path;interror;+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(structinput_devres),GFP_KERNEL);
From: Benjamin Tissoires <hidden> Date: 2017-02-01 08:35:50
On Jan 31 2017 or thereabouts, Dmitry Torokhov wrote:
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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Looks good to me:
Reviewed-by: Benjamin Tissoires <redacted>
Cheers,
Benjamin
@@ -2095,6 +2095,12 @@ int input_register_device(struct input_dev *dev)constchar*path;interror;+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(structinput_devres),GFP_KERNEL);
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.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>