Re: [PATCH v6] usb: gadget: uvc: Fix deadlocks in uvcg_configfs attribute callbacks

From: Greg KH

Date: Fri Nov 20 2026 - 03:21:13 EST


On Fri, Nov 06, 2026 at 09:15:44PM -0800, Saad Varshani wrote:
> Removed su_mutex locking in the function uvcg_extension_bm_controls_store.
> Done this due to the deadlock caused by the mutex conflict in
> fs/configfs_write_iter. Validated commit with the C repro provided by
> syzbot. No other conficts observed.
>
> Also removed the su_mutex in the other attribute extension functions.
> Such as uvcg_extension_b_control_size_store. This applies to all
> uvcg_configfs attribute store/show functions.
>
> The deadlock was happening due to a circular mutex dependency between
> configfs (frag_sem) and uvcg_extension su_mutex. The reason it is safe
> to traverse item->ci_parent without su_mutex is because
> configfs_write_iter() calls flush_write_buffer() which calls the
> attribute function, holding frag_sem. Which prevents configfs_rmdir()
> from unlinking the item or its ci_parent hierarchy
>
> Also reordered fmt->linked in uvcg_frame_b_frame_index_show() to be
> under the &opts->lock. As well as reorder refcnt in uvcg_color_matching
> store to be under &opts->lock.
>
> Applied opts->lock mutex, to functions uvcg_format_allow_link(),
> uvcg_format_drop_link(), uvcg_uncompressed_make(), uvcg_mjpeg_make(),
> and uvcg_framebased_make() due to them also modifying
> color_match->refcnt, to avoid concurrency issues.
>
> ---
> v6 changes:
> - Fix compiler errors introduced in v5, due to forgetting to
> test compile, and add the required variables to the modified
> functions.

That doesn't belong here, it belongs below:

> Reported-by: syzbot+300213c2b5b55c0244f4@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzbot.org/bug?extid=300213c2b5b55c0244f4
> Signed-off-by: Saad Varshani <varshanisaad@xxxxxxxxx>
> ---

Right here.

thanks,

greg k-h