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

Eugen Hristev <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media
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]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.