Re: [PATCH v7] usb: gadget: uvc: Fix deadlocks in uvcg_configfs attribute callbacks
From: Keisuke Tsukuda
Date: Wed Dec 02 2026 - 07:58:10 EST
On Sat, Nov 21, 2026 at 17:38:44 -0800, Saad Varshani wrote:
> The deadlock was happening due to a circular mutex dependency between
> configfs (frag_sem) and uvcg_extension su_mutex.
I ran the C reproducer from the syzbot report in an ARM64 QEMU guest
with CONFIG_PROVE_LOCKING=y. The test kernel's uvc_configfs.c matched
the preimage of Timo Joannin's submitted patch. Before that change, the
bmControls write reported a circular locking dependency in
uvcg_extension_bm_controls_store(), and debug_locks changed from 1 to 0.
After applying only that patch, the same reproducer completed without
that warning and debug_locks stayed at 1.
Timo's patch was committed to usb-testing as a3f3e1390f47
("usb: gadget: uvc: remove su_mutex from configfs _show/_store
callbacks"). Most of v7 overlaps it, and v7 no longer applies there.
I also compared the remaining lock changes. The format link callbacks
look up configfs items under su_mutex. The make callbacks run under
su_mutex as well, and their new format objects are not linked into
configfs until they return. Both versions protect the shared color
matching reference counts with opts->lock. I could not identify a
separate race prevented by v7's wider opts->lock scope in those paths.
Is there another reproducer for the wider lock scope? If so, a patch on
top of a3f3e1390f47 with only the remaining change would be easier to
review.
Thanks,
Keisuke