On Wed Sep 23 09:56:31 2026 +0800, Ginger Li wrote:
> ov5648_s_stream() updates state->streaming after it has released
> sensor->mutex, while ov5648_resume() reads that field with sensor->mutex
> held. A concurrent resume can therefore observe a stale streaming state
> and leave the sensor in standby while the software believes that it is
> streaming, or the other way around.
> 
> Keep the update inside the sensor->mutex protected section that already
> programs the standby mode.
> 
> Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor")
> Signed-off-by: Ginger Li <[email protected]>
> Reviewed-by: Kieran Bingham <[email protected]>
> Signed-off-by: Sakari Ailus <[email protected]>

Patch committed.

Thanks,
Sakari Ailus

 drivers/media/i2c/ov5648.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c
index d06f5ebd9464..6a1efa12c38d 100644
--- a/drivers/media/i2c/ov5648.c
+++ b/drivers/media/i2c/ov5648.c
@@ -2145,13 +2145,13 @@ static int ov5648_s_stream(struct v4l2_subdev *subdev, 
int enable)
 
        mutex_lock(&sensor->mutex);
        ret = ov5648_sw_standby(sensor, !enable);
+       if (!ret)
+               state->streaming = !!enable;
        mutex_unlock(&sensor->mutex);
 
        if (ret)
                return ret;
 
-       state->streaming = !!enable;
-
        if (!enable)
                pm_runtime_put(sensor->dev);
 
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to