summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatya Orlova <e.orlova@ispras.ru>2023-09-22 14:55:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 11:08:27 +0100
commitdb89f551b7067cea61f47194acdec62a24e83ceb (patch)
tree9e1780081c0afdb31cb3224efb530750f4241267
parent51c94256a83fe4e17406c66ff3e1ad7d242d8574 (diff)
downloadlinux-db89f551b7067cea61f47194acdec62a24e83ceb.tar.gz
linux-db89f551b7067cea61f47194acdec62a24e83ceb.tar.bz2
linux-db89f551b7067cea61f47194acdec62a24e83ceb.zip
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>
-rw-r--r--drivers/media/platform/s3c-camif/camif-capture.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 140854ab4dd8..d6b7fbd49a5c 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -1132,12 +1132,12 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)
ret = vb2_queue_init(q);
if (ret)
- goto err_vd_rel;
+ return ret;
vp->pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&vfd->entity, 1, &vp->pad);
if (ret)
- goto err_vd_rel;
+ return ret;
video_set_drvdata(vfd, vp);
@@ -1170,8 +1170,6 @@ err_ctrlh_free:
v4l2_ctrl_handler_free(&vp->ctrl_handler);
err_me_cleanup:
media_entity_cleanup(&vfd->entity);
-err_vd_rel:
- video_device_release(vfd);
return ret;
}