Skip to content

Commit

Permalink
video VIDIO_QBUF ioctl: Check range of index parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Thoma <johannes@johannesthoma.com>
  • Loading branch information
johannesthoma authored and tkisky committed Jan 13, 2021
1 parent d23084b commit 5272544
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/platform/mxc/capture/mxc_v4l2_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,10 @@ static long mxc_v4l_do_ioctl(struct file *file,
int index = buf->index;
pr_debug(" case VIDIOC_QBUF, length=%d\n", buf->length);

if (index < 0 || index >= FRAME_NUM) {
retval = -EINVAL;
break;
}
spin_lock_irqsave(&cam->queue_int_lock, lock_flags);
if ((cam->frame[index].buffer.flags & 0x7) ==
V4L2_BUF_FLAG_MAPPED) {
Expand Down

0 comments on commit 5272544

Please sign in to comment.