Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fb5e59c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull HID fix from Jiri Kosina:
 "hiddev ioctl() validation fix from Scott Bauer"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands
parents 260eaba4 93a2001b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -516,12 +516,12 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
					goto inval;
			} else if (uref->usage_index >= field->report_count)
				goto inval;
		}

			else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
		if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
		    (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
		     uref->usage_index + uref_multi->num_values > field->report_count))
			goto inval;
		}

		switch (cmd) {
		case HIDIOCGUSAGE: