media: v4l: ioctl: Validate num_planes before using it
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 10 Jan 2019 12:43:19 +0000 (07:43 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 16 Jan 2019 16:12:10 +0000 (11:12 -0500)
commit9048b2e15b11c591c649cc6edc7a64fa62c15419
treeb2db22dae3e4800d48dffe3303ae09e97c7ac70b
parentdd91642ac71208fe972a9c577ed52b6b3ba7b732
media: v4l: ioctl: Validate num_planes before using it

The for loop to reset the memory of the plane reserved fields runs over
num_planes provided by the user without validating it. Ensure num_planes
is no more than VIDEO_MAX_PLANES before the loop.

Fixes: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c