usb: gadget: f_tcm: fix deadlock in usbg_make_tpg()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 4bb8548df632187d5db50878e71804af5f7c51ad · < 6bcd9ee6ad6989d1d85a7459687e45b7ad7568d9| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_tcm: fix deadlock in usbg_make_tpg()
usbg_make_tpg() held dep_lock while calling configfs_depend_item_unlocked(), which acquires the configfs root inode lock when operating across subsystems. This creates a circular lock dependency with configfs_rmdir():
dep_lock -> configfs root inode lock -> su_mutex -> dep_lock
In usbg_make_tpg(), dep_lock only serialized the read of opts->ready, which is a monotonic flag that transitions from false to true exactly once (in tcm_set_name()) and never reverts. Remove dep_lock from usbg_make_tpg() entirely and use READ_ONCE/WRITE_ONCE to access opts->ready locklessly instead.
From the CVE record · Linux
The Linux kernel’s USB gadget f_tcm component has a circular lock dependency in usbg_make_tpg() when configfs operations cross subsystems. This can cause a deadlock with configfs_rmdir(); the input does not specify attacker access requirements or user interaction.
Engineers running Linux kernels with the USB gadget f_tcm component should check whether their kernel is affected; affected versions are not specified.