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: 9188e79ec3 ("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>
This commit is contained in:
committed by
Jiri Kosina
parent
8c62074fa8
commit
75d5546f60
@@ -48,6 +48,8 @@ struct hidraw_devinfo {
|
||||
#define HIDIOCGOUTPUT(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0C, len)
|
||||
#define HIDIOCREVOKE _IOW('H', 0x0D, int) /* Revoke device access */
|
||||
|
||||
#define HIDIOCTL_LAST _IOC_NR(HIDIOCREVOKE)
|
||||
|
||||
#define HIDRAW_FIRST_MINOR 0
|
||||
#define HIDRAW_MAX_DEVICES 64
|
||||
/* number of reports to buffer */
|
||||
|
||||
Reference in New Issue
Block a user