diff options
author | Mark Brown <broonie@kernel.org> | 2020-10-06 17:19:24 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-10-06 17:19:24 +0200 |
commit | fd6b519a30a7179026d22c98d6bf10bb5ca8ca27 (patch) | |
tree | e4a6bc4d8548a5b8db7148a18eb257b84e72d48b /drivers/hid/usbhid/hiddev.c | |
parent | Merge series "ASoC: Intel: Remove obsolete solutions and components" from Cez... (diff) | |
parent | Linux 5.9-rc5 (diff) | |
download | linux-fd6b519a30a7179026d22c98d6bf10bb5ca8ca27.tar.xz linux-fd6b519a30a7179026d22c98d6bf10bb5ca8ca27.zip |
Merge tag 'v5.9-rc5' into asoc-5.10
Linux 5.9-rc5
Diffstat (limited to 'drivers/hid/usbhid/hiddev.c')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 4140dea693e9..45e0b1c75cb1 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -519,12 +519,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, switch (cmd) { case HIDIOCGUSAGE: + if (uref->usage_index >= field->report_count) + goto inval; uref->value = field->value[uref->usage_index]; if (copy_to_user(user_arg, uref, sizeof(*uref))) goto fault; goto goodreturn; case HIDIOCSUSAGE: + if (uref->usage_index >= field->report_count) + goto inval; field->value[uref->usage_index] = uref->value; goto goodreturn; @@ -781,7 +785,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) break; case HIDIOCGUCODE: - /* fall through */ case HIDIOCGUSAGE: case HIDIOCSUSAGE: case HIDIOCGUSAGES: |