Linux Media Controller development
 help / color / mirror / Atom feed
From: Robert Ijtsma via B4 Relay <devnull+robertijtsma.gmail.com@kernel.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	 Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	 Loic Poulain <loic.poulain@oss.qualcomm.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 Robert Ijtsma <robertijtsma@gmail.com>
Subject: [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities
Date: Sun, 22 Nov 2026 14:35:52 +0100	[thread overview]
Message-ID: <20261122-camss-fixes-v1-4-9df4deb87ea2@gmail.com> (raw)
In-Reply-To: <20261122-camss-fixes-v1-0-9df4deb87ea2@gmail.com>

From: Robert Ijtsma <robertijtsma@gmail.com>

msm_vfe_unregister_entities() destroys vfe->power_lock and
vfe->stream_lock before unregistering the VFE video devices and V4L2
subdevices. Active userspace handles or concurrent teardown callbacks
can still acquire these mutexes until the entities are unregistered.

Destroy power_lock and stream_lock after all VFE entities have been
unregistered and cleaned up.

Fixes: 4c98a5f57f90 ("media: camss: Add VFE files")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
 drivers/media/platform/qcom/camss/camss-vfe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index ad09593..fe6b7ef 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -2168,9 +2168,6 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe)
 {
 	int i;
 
-	mutex_destroy(&vfe->power_lock);
-	mutex_destroy(&vfe->stream_lock);
-
 	for (i = 0; i < vfe->res->line_num; i++) {
 		struct v4l2_subdev *sd = &vfe->line[i].subdev;
 		struct camss_video *video_out = &vfe->line[i].video_out;
@@ -2179,6 +2176,9 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe)
 		v4l2_device_unregister_subdev(sd);
 		media_entity_cleanup(&sd->entity);
 	}
+
+	mutex_destroy(&vfe->power_lock);
+	mutex_destroy(&vfe->stream_lock);
 }
 
 bool vfe_is_lite(struct vfe_device *vfe)

-- 
2.56.0



  parent reply	other threads:[~2026-11-22 13:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` Robert Ijtsma via B4 Relay [this message]
2026-11-22 13:35 ` [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure Robert Ijtsma via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122-camss-fixes-v1-4-9df4deb87ea2@gmail.com \
    --to=devnull+robertijtsma.gmail.com@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=robertijtsma@gmail.com \
    --cc=vladimir.zapolskiy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox