Re: [PATCH v4 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle
From: Eugen Hristev
Date: Wed Aug 05 2026 - 02:24:44 EST
On 8/3/26 13:20, Balakrishnan Sambath wrote:
> isc->lock and awb_mutex were initialised in isc_async_complete() and
> destroyed in isc_async_unbind(), tying their lifetime to the subdev
> bind/unbind cycle instead of the device:
>
> - isc_async_unbind() destroyed awb_mutex before cancel_work_sync(),
> which takes it;
> - a failed .complete() left them initialised, and isc->lock was
> destroyed only on the .complete() error path, so the normal unbind
> path leaked it;
> - a rebind runs .complete() again and reinitialises a live mutex.
>
> Initialise both with devm_mutex_init() at probe so they live for the
> whole device lifetime and are freed at remove, and drop the init and
> destroy from the .complete()/.unbind() callbacks.
>
> isc_async_complete_err then only returned ret, so drop the label and
> return directly at each error site.
>
> Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
Reviewed-by: Eugen Hristev <ehristev@xxxxxxxxxx>