Skip to content

Commit

Permalink
media: v4l2-compat-ioctl32: prevent go past max size
Browse files Browse the repository at this point in the history
commit ea72fbf upstream.

As warned by smatch:
	drivers/media/v4l2-core/v4l2-compat-ioctl32.c:879 put_v4l2_ext_controls32() warn: check for integer overflow 'count'

The access_ok() logic should check for too big arrays too.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mauro Carvalho Chehab authored and Greg Kroah-Hartman committed Jul 3, 2018
1 parent 8d2e0fa commit 77edeac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/v4l2-core/v4l2-compat-ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ static int put_v4l2_ext_controls32(struct file *file,
get_user(kcontrols, &kp->controls))
return -EFAULT;

if (!count)
if (!count || count > (U32_MAX/sizeof(*ucontrols)))
return 0;
if (get_user(p, &up->controls))
return -EFAULT;
Expand Down

0 comments on commit 77edeac

Please sign in to comment.