media: qcom: camss: Fix pipeline lock leak in stop_streaming
Subsystems (7)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 media: qcom: camss: Fix pipeline lock leak in stop_streaming
When a browser or application closes the camera, if any subdevice fails to stop streaming, video_stop_streaming() returns early without calling video_device_pipeline_stop(). This leaves the pipeline permanently locked, preventing any future camera access until reboot.
Fix this by logging errors but continuing to stop all remaining subdevices and always releasing the pipeline lock, even when errors occur during the stop sequence.
Tested-on: Lenovo Yoga Slim 7x (Snapdragon X Elite, ov02c10 camera)
--- drivers/media/platform/qcom/camss/camss-video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-video.c +8 -2
@@ -312,9 +312,15 @@ static void video_stop_streaming(struct vb2_queue *q) ret =v4l2_subdev_call (subdev, video, s_stream,0 ); +/* +* Don't return early on error - we must continue to stop +* remaining subdevices and release the pipeline lock to +* prevent the camera from being permanently locked. +*/ if (ret) { -dev_err (video->camss->dev,"Video pipeline stop failed: %d\n" , ret); -return ; +dev_err (video->camss->dev, +"Failed to stop subdev '%s': %d\n" , + subdev->name, ret); } }
Signature · 1 line
2.51.0
PATCH 1/1 media: i2c: ov02c10: Check for errors in disable_streams
In reply to a message not in the archiveThe ov02c10_disable_streams() function ignores the return value from cci_write() when stopping the sensor. If the I2C write fails (e.g., due to CCI timeout, power management race, or device removal), the error is silently lost.
While we still need to return 0 and call pm_runtime_put() regardless of hardware state (to prevent PM reference leaks and pipeline lock issues), we should at least log when the hardware stop fails.
This change:
1. Captures the cci_write() return value
2. Logs an error if the write fails
3. Still returns 0 to ensure proper cleanup
Returning an error from disable_streams would cause the camss driver's video_stop_streaming() to exit early without releasing the pipeline lock, permanently locking the camera.
--- drivers/media/i2c/ov02c10.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/i2c/ov02c10.c +5 -1
@@ -629,8 +629,12 @@ static int ov02c10_disable_streams(struct v4l2_subdev *sd, u32 pad, u64 streams_mask) {struct ov02c10 *ov02c10 =to_ov02c10 (sd); +int ret; + + ret =cci_write (ov02c10->regmap,OV02C10_REG_STREAM_CONTROL ,0 ,NULL ); +if (ret) +dev_err (ov02c10->dev,"failed to stop streaming: %d\n" , ret); -cci_write (ov02c10->regmap,OV02C10_REG_STREAM_CONTROL ,0 ,NULL );pm_runtime_put (ov02c10->dev);return 0 ;
Signature · 1 line
2.51.0