Skip to content

Commit b0579fc

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: evdev - fix EVIOCSABS regression Input: evdev - fix Ooops in EVIOCGABS/EVIOCSABS
2 parents 7f81c56 + f9ce6eb commit b0579fc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/input/evdev.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
669669

670670
if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
671671

672+
if (!dev->absinfo)
673+
return -EINVAL;
674+
672675
t = _IOC_NR(cmd) & ABS_MAX;
673676
abs = dev->absinfo[t];
674677

@@ -680,10 +683,13 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
680683
}
681684
}
682685

683-
if (_IOC_DIR(cmd) == _IOC_READ) {
686+
if (_IOC_DIR(cmd) == _IOC_WRITE) {
684687

685688
if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
686689

690+
if (!dev->absinfo)
691+
return -EINVAL;
692+
687693
t = _IOC_NR(cmd) & ABS_MAX;
688694

689695
if (copy_from_user(&abs, p, min_t(size_t,

0 commit comments

Comments
 (0)