Re: [PATCH v3] staging: media: atomisp: add missing mutex lock in atomisp_s_fmt_cap

From: Andy Shevchenko
Date: Thu Jul 17 2025 - 08:54:39 EST


On Thu, Jul 17, 2025 at 3:43 PM Abdelrahman Fekry
<abdelrahmanfekry375@xxxxxxxxx> wrote:
>
> The function atomisp_set_fmt() modifies shared device state and expects
> callers to hold the isp->mutex for synchronization. While most internal
> callers correctly lock the mutex before invoking atomisp_set_fmt(), the
> V4L2 ioctl handler atomisp_s_fmt_cap() does not.
>
> This results in an unsafe execution path for VIDIOC_S_FMT ioctls
> (e.g. via v4l2-ctl), where shared structures such as pipe->pix and
> pipe->frame_info may be modified concurrently without proper protection.
>
> - Fix this by explicitly locking isp->mutex in atomisp_s_fmt_cap().

Now LGTM, FWIW,
Reviewed-by: Andy Shevchneko <andy@xxxxxxxxxx>

--
With Best Regards,
Andy Shevchenko