Commit c179c985 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Greg Kroah-Hartman

media: uvcvideo: Fix ENUMINPUT handling

commit 31c5f0c5 upstream.

Properly validate the user-supplied index against the number of inputs.
The code used the pin local variable instead of the index by mistake.
Reported-by: default avatarJozef Vesely <vesely@gjh.sk>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ee93602
...@@ -710,7 +710,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -710,7 +710,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
break; break;
} }
pin = iterm->id; pin = iterm->id;
} else if (pin < selector->bNrInPins) { } else if (index < selector->bNrInPins) {
pin = selector->baSourceID[index]; pin = selector->baSourceID[index];
list_for_each_entry(iterm, &chain->entities, chain) { list_for_each_entry(iterm, &chain->entities, chain) {
if (!UVC_ENTITY_IS_ITERM(iterm)) if (!UVC_ENTITY_IS_ITERM(iterm))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment