mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
Input: uinput - fix crash when mixing old and new init style
If user tries to initialize uinput device mixing old and new style
initialization (i.e. using old UI_SET_ABSBIT instead of UI_ABS_SETUP,
we forget to allocate input->absinfo and will crash when trying to send
absolute events:
ioctl(ui, UI_DEV_SETUP, &us);
ioctl(ui, UI_SET_PHYS, "Test");
ioctl(ui, UI_SET_EVBIT, EV_ABS);
ioctl(ui, UI_SET_ABSBIT, ABS_X);
ioctl(ui, UI_SET_ABSBIT, ABS_Y);
ioctl(ui, UI_DEV_CREATE, 0);
Reported-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=191811
Fixes: fbae10db09
("Input: uinput - rework ABS validation")
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
05e0be7c90
commit
601bbbe051
1 changed files with 14 additions and 6 deletions
|
@ -263,13 +263,21 @@ static int uinput_create_device(struct uinput_device *udev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(ABS_MT_SLOT, dev->absbit)) {
|
if (test_bit(EV_ABS, dev->evbit)) {
|
||||||
nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
|
input_alloc_absinfo(dev);
|
||||||
error = input_mt_init_slots(dev, nslot, 0);
|
if (!dev->absinfo) {
|
||||||
if (error)
|
error = -EINVAL;
|
||||||
goto fail1;
|
goto fail1;
|
||||||
} else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
|
}
|
||||||
input_set_events_per_packet(dev, 60);
|
|
||||||
|
if (test_bit(ABS_MT_SLOT, dev->absbit)) {
|
||||||
|
nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
|
||||||
|
error = input_mt_init_slots(dev, nslot, 0);
|
||||||
|
if (error)
|
||||||
|
goto fail1;
|
||||||
|
} else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
|
||||||
|
input_set_events_per_packet(dev, 60);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(EV_FF, dev->evbit) && !udev->ff_effects_max) {
|
if (test_bit(EV_FF, dev->evbit) && !udev->ff_effects_max) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue