]> git.baikalelectronics.ru Git - kernel.git/commit
media: v4l: ioctl: Sanitize num_planes before using it
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 18 Feb 2019 10:25:42 +0000 (05:25 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 18 Feb 2019 15:13:38 +0000 (10:13 -0500)
commitd0fbb91bb088ffe17012ba221a0a16f678d5f39e
treeee1fac4cbfa037a96b75d7513e1b8c6b34544b34
parent3be4ea57c58ce2b28ee5692a9a87fac57fce3107
media: v4l: ioctl: Sanitize num_planes before using it

The linked commit changed s_fmt/try_fmt to fail if num_planes is bogus.
This, however, is against the spec, which mandates drivers
to return a proper num_planes value, without an error.

Replace the num_planes check and instead clamp it to a sane value,
so we still make sure we don't overflow the planes array by accident.

Fixes: acf0ff15c3349e ("media: v4l: ioctl: Validate num_planes before using it")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c