Re: [PATCH] media: atmel-isi: release unregistered video device on remove
From: Eugen Hristev
Date: Fri Sep 25 2026 - 15:15:35 EST
On 9/15/26 14:25, Guangshuo Li wrote:
> atmel_isi_probe() allocates the video device before registering the
> V4L2 async notifier. The video device is registered later from the
> notifier complete callback once the remote subdevice has been bound.
>
> The remove path relies on the notifier unbind callback to unregister
> the video device. However, if the remote subdevice is never bound, or
> the complete callback fails before video_register_device() succeeds,
> the video device remains unregistered. In that case the unbind path
> does not release the object allocated by video_device_alloc(), and the
> remove path leaks it.
>
> Only unregister the video device from the unbind callback when it has
> actually been registered, and clear the driver pointer afterwards.
> After unregistering and cleaning up the notifier, release the video
> device directly if the pointer is still present. This covers devices
> that were allocated but never registered while avoiding a second
> release of successfully registered devices.
>
> This issue was found by manual code inspection.
>
> Fixes: d12c9088c0b2a ("[media] atmel-isi: remove dependency of the soc-camera framework")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
> ---
Reviewed-by: Eugen Hristev <ehristev@xxxxxxxxxx>