media: vivid: s_fbuf: add more sanity checks
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 12 Oct 2022 14:32:28 +0000 (15:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:59:17 +0000 (23:59 +0900)
commit5b1fb2a28d0a17338d10664068ddef07372f49d4
tree139415be7a88a179957b3cb9a1a5b1082908b25b
parent3436e5633776d2677c3a55c70981c7eacf1508a7
media: vivid: s_fbuf: add more sanity checks

[ Upstream commit f8bcaf714abfc94818dff8c0db84d750433984f4 ]

VIDIOC_S_FBUF is by definition a scary ioctl, which is why only root
can use it. But at least check if the framebuffer parameters match that
of one of the framebuffer created by vivid, and reject anything else.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/test-drivers/vivid/vivid-core.c
drivers/media/test-drivers/vivid/vivid-core.h
drivers/media/test-drivers/vivid/vivid-vid-cap.c