Race Condition in Linux Kernel Affecting USB Gadget Functionality
CVE-2025-40315
What is CVE-2025-40315?
A race condition exists in the USB gadget subsystem of the Linux kernel that arises when the ffs_func_eps_enable() function is executed simultaneously with ffs_data_reset(). This situation can lead to a null pointer dereference due to the premature setting of the ffs->epfiles pointer to NULL during the execution of ffs_data_clear() in ffs_data_reset(). The improper handling of this pointer in the context of enabled endpoints can cause significant instability in USB operations. The fix requires enhanced NULL pointer handling within the ffs_func_eps_enable() function to mitigate the risks associated with concurrent access to these resources.
Affected Version(s)
Linux 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Linux 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 1c0dbd240be3f87cac321b14e17979b7e9cb6a8f
Linux 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 9ec40fba7357df2d36f4c2e2f3b9b1a4fba0a272