[media] v4l: compat: Prevent allocating excessive amounts of memory
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 8 Nov 2016 16:06:44 +0000 (14:06 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 22 Nov 2016 12:31:23 +0000 (10:31 -0200)
commita56bc171598c788fd43168b5c81df8ac3c7fbde4
treeee1199981f7ad41d398c101dbcff68a816731089
parentaf93189d4ebc7851eb387145d0ea8db52698308e
[media] v4l: compat: Prevent allocating excessive amounts of memory

get_v4l2_ext_controls32() is used to convert the 32-bit compat struct into
native 64-bit representation. The function multiplies the array length by
the entry length before validating size. Perform the size validation
first.

Also use unsigned values for size computation.

Make similar changes to get_v4l2_buffer32() for multi-plane buffers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c