[PATCH v1 0/2] Input: evdev/uinput errno alignment

Iván Ezequiel Rodriguez posted 2 patches 3 weeks, 4 days ago
There is a newer version of this series
drivers/input/evdev.c       | 5 +++--
drivers/input/misc/uinput.c | 9 ++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
[PATCH v1 0/2] Input: evdev/uinput errno alignment
Posted by Iván Ezequiel Rodriguez 3 weeks, 4 days ago
Hi,

Two small fixes so ioctl failures match what helpers and uapi docs
already document.

Patch 1 propagates the return value of input_ff_effect_from_user()
from EVIOCSFF instead of always mapping failures to -EFAULT (wrong
size becomes -EINVAL).

Patch 2 returns -EINVAL for UI_ABS_SETUP when the axis code is out of
range (was -ERANGE) and rejects ABS_MT_SLOT with a non-zero minimum.

Base: v7.3-rc1

Tested: built bzImage with CONFIG_INPUT_UINPUT=y and CONFIG_INPUT_EVDEV=y;
QEMU initramfs smoke:

  - UI_ABS_SETUP with code > ABS_MAX → EINVAL
  - UI_ABS_SETUP ABS_MT_SLOT with min != 0 → EINVAL
  - EVIOCSFF with wrong size → EINVAL

Thanks,
Iván

Iván Ezequiel Rodriguez (2):
  Input: evdev: propagate EVIOCSFF copy errors correctly
  Input: uinput: align UI_ABS_SETUP validation with uapi docs

 drivers/input/evdev.c       | 5 +++--
 drivers/input/misc/uinput.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.43.0
[PATCH v2 0/2] Input: evdev/uinput errno alignment
Posted by Iván Ezequiel Rodriguez 3 weeks, 4 days ago
Two small fixes making evdev and uinput report the error codes their
uapi documentation promises.

Changes since v1:
 - Dropped the ABS_MT_SLOT "minimum must be 0" validation from patch 2.
   It was a userspace regression: uinput_create_device() already calls
   input_mt_init_slots() for devices declaring ABS_MT_SLOT, and
   input_mt_init_slots() overwrites the axis with
   input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0).
   A non-zero minimum is therefore accepted today and silently
   corrected, so rejecting it with -EINVAL would break existing
   callers.
 - Patch 2 is now limited to the -ERANGE to -EINVAL change and its
   commit message was reworded accordingly.
 - Patch 1 is unchanged.

v1: https://lore.kernel.org/linux-input/20260831152156.166514-1-ivanrwcm25@gmail.com/

Iván Ezequiel Rodriguez (2):
  Input: evdev: propagate EVIOCSFF copy errors correctly
  Input: uinput: return -EINVAL for out-of-range UI_ABS_SETUP axis code

 drivers/input/evdev.c       | 5 +++--
 drivers/input/misc/uinput.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

-- 
2.43.0