The Linux kernel developers have resolved a critical vulnerability in the USB gadget function file system (f_fs) by removing an unnecessary WARN_ON call in functionfs_bind. This issue could potentially lead to a kernel panic in certain scenarios when panic_on_warn is enabled. You can find more information about this patch in this commit.

_Problem:_

The adb_open, adb_read, and adb_write operations in the Android Debug Bridge (ADB) daemon can lead to a race condition with a UDC (USB Device Controller) write attempt through configfs. This race condition results in a kernel panic due to the WARN_ON call in functionfs_bind when panic_on_warn is enabled, as shown in the following snippet:

[   14.542395] Kernel panic - not syncing: kernel: panic_on_warn set ...
[   14.542464] Call trace:
[   14.542468]  ffs_func_bind+x1c8/x14a8
[   14.542473]  usb_add_function+xcc/x1f
[   14.542478]  configfs_composite_bind+x468/x588
[   14.542483]  gadget_bind_driver+x108/x27c
[   14.542488]  really_probe+x190/x374
[   14.542492]  __driver_probe_device+xa/x12c
[   14.542498]  driver_probe_device+x3c/x220
[   14.542502]  __driver_attach+x11c/x1fc
[   14.542506]  bus_for_each_dev+x104/x160
[   14.542510]  driver_attach+x24/x34
[   14.542514]  bus_add_driver+x154/x270
[   14.542518]  driver_register+x68/x104
[   14.542523]  usb_gadget_register_driver_owner+x48/xf4
[   14.542526]  gadget_dev_desc_UDC_store+xf8/x144
[   14.542529]  configfs_write_iter+xf/x138

_Solution:_

The kernel developers have addressed this issue by removing the WARN_ON call from the functionfs_bind function, which in turn prevents the aforementioned kernel panic from occurring. This change has been applied in this commit.

_Conclusion:_

This patch effectively resolves the vulnerability designated as CVE-2024-57913, which could potentially cause a kernel panic due to a race condition between ADB operations and UDC writes through configfs. System administrators and users should update their Linux kernel installations to include this patch as soon as possible in order to protect their systems from potential issues related to this vulnerability.

Timeline

Published on: 01/19/2025 12:15:25 UTC
Last modified on: 02/27/2025 21:59:09 UTC