Re: [PATCH v4 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle

Eugen Hristev <[email protected]> Wed, 5 Aug 2026 09:19:42 +0300
Newsgroups org.kernel.vger.linux-media,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
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: [email protected]
> Signed-off-by: Balakrishnan Sambath <[email protected]>

Reviewed-by: Eugen Hristev <[email protected]>