media: s3c-camif: Avoid inappropriate kfree()
authorKatya Orlova <e.orlova@ispras.ru>
Fri, 22 Sep 2023 11:55:06 +0000 (14:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:32 +0000 (11:59 +0100)
commitf93844d2c8a753163987b2ef16ce203c5b96258c
tree26dd30dec46aa39d1d0d742f76caeab58672f067
parent495fd088870c9c5c20133046ff60d96f02bf70e1
media: s3c-camif: Avoid inappropriate kfree()

[ Upstream commit 61334819aca018c3416ee6c330a08a49c1524fc3 ]

s3c_camif_register_video_node() works with video_device structure stored
as a field of camif_vp, so it should not be kfreed.
But there is video_device_release() on error path that do it.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
Signed-off-by: Katya Orlova <e.orlova@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/samsung/s3c-camif/camif-capture.c