]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: hidraw: tighten ioctl command parsing
authorBenjamin Tissoires <bentiss@kernel.org>
Fri, 12 Sep 2025 16:58:51 +0000 (18:58 +0200)
committerJiri Kosina <jkosina@suse.com>
Wed, 17 Sep 2025 09:37:23 +0000 (11:37 +0200)
commit75d5546f60b36900051d75ee623fceccbeb6750c
tree719960fbed6a2a8f900d3f7074c2749bcac171fc
parent8c62074fa824db0878a039e40f8424c3c3284f42
HID: hidraw: tighten ioctl command parsing

The handling for variable-length ioctl commands in hidraw_ioctl() is
rather complex and the check for the data direction is incomplete.

Simplify this code by factoring out the various ioctls grouped by dir
and size, and using a switch() statement with the size masked out, to
ensure the rest of the command is correctly matched.

Fixes: 9188e79ec3fd ("HID: add phys and name ioctls to hidraw")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hidraw.c
include/uapi/linux/hidraw.h