Dear stable team,
Patch : usb: dwc3: Remove DWC3 locking during gadget suspend/resume
Commit id:5265397f94424eaea596026fd34dc7acf474dcec
This patch fixes a critical bug in the dwc3 driver that was introduced by commit (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/driv... https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/usb/dwc3/gadget.c?h=v5.10.240&id=90e2820c6c30db2427d020d344dfca7de813bd24) in the 5.10 kernel series.
The bug causes the below kernel crash (Added usleep in atomic context as part of above patch) under dwc3 suspend/resume scenarios.
35.829644] [6: kworker/6:1: 68] BUG: scheduling while atomic: kworker/6:1/68/0x00000002
[ 35.829946] [6: kworker/6:1: 68] CPU: 6 PID: 68 Comm: kworker/6:1 Tainted: G C E 5.10.236-android13-4 #1
[ 35.830010] [6: kworker/6:1: 68] Call trace:
[ 35.830024] [6: kworker/6:1: 68] dump_backtrace.cfi_jt+0x0/0x8
[ 35.830034] [6: kworker/6:1: 68] show_stack+0x1c/0x2c
[ 35.830044] [6: kworker/6:1: 68] dump_stack_lvl+0xd8/0x134
[ 35.830053] [6: kworker/6:1: 68] __schedule_bug+0x80/0xbc
[ 35.830062] [6: kworker/6:1: 68] __schedule+0x55c/0x7e8
[ 35.830068] [6: kworker/6:1: 68] schedule+0x80/0x100
[ 35.830077] [6: kworker/6:1: 68] schedule_hrtimeout_range_clock+0xa8/0x11c
[ 35.830083] [6: kworker/6:1: 68] usleep_range+0x68/0xa4
[ 35.830093] [6: kworker/6:1: 68] dwc3_gadget_run_stop+0x170/0x448
[ 35.830099] [6: kworker/6:1: 68] dwc3_gadget_resume+0x4c/0xdc
[ 35.830108] [6: kworker/6:1: 68] dwc3_resume_common+0x6c/0x23c
[ 35.830115] [6: kworker/6:1: 68] dwc3_runtime_resume+0x40/0xcc
[ 35.830123] [6: kworker/6:1: 68] pm_generic_runtime_resume+0x48/0x88
[ 35.830131] [6: kworker/6:1: 68] __rpm_callback+0x94/0x420
The patch(5265397f9442) for this fix was originally merged in the below commit:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/d... https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/usb/dwc3?h=next-20250820&id=5265397f94424eaea596026fd34dc7acf474dcec
Please apply this patch to the stable 5.10 kernel to prevent this BUG.
Additionally the below patch also required to avoid dead lock that introduced by the abovepatch (5265397f9442) in 5.10 stable kernel.
Patch:usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock
Commit id:7838de15bb700c2898a7d741db9b1f3cbc86c136
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/d... https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/usb/dwc3?h=next-20250820&id=7838de15bb700c2898a7d741db9b1f3cbc86c136
Thanks,
Selva