CVE-2025-71079: net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write
In the Linux kernel, the following vulnerability has been resolved:
net: nfc: fix deadlock between nfcunregisterdevice and rfkillfopwrite
A deadlock can occur between nfcunregisterdevice() and rfkillfopwrite() due to lock ordering inversion between devicelock and rfkillglobalmutex.
The problematic lock order is:
Thread A (rfkillfopwrite): rfkillfopwrite() mutexlock(&rfkillglobalmutex) rfkillsetblock() nfcrfkillsetblock() nfcdevdown() devicelock(&dev->dev) <- waits for devicelock
Thread B (nfcunregisterdevice): nfcunregisterdevice() devicelock(&dev->dev) rfkillunregister() mutexlock(&rfkillglobalmutex) <- waits for rfkillglobalmutex
This creates a classic ABBA deadlock scenario.
Fix this by moving rfkillunregister() and rfkilldestroy() outside the devicelock critical section. Store the rfkill pointer in a local variable before releasing the lock, then call rfkillunregister() after releasing devicelock.
This change is safe because rfkillfopwrite() holds rfkillglobalmutex while calling the rfkill callbacks, and rfkillunregister() also acquires rfkillglobalmutex before cleanup. Therefore, rfkillunregister() will wait for any ongoing callback to complete before proceeding, and devicedel() is only called after rfkillunregister() returns, preventing any use-after-free.
The similar lock ordering in nfcregisterdevice() (devicelock -> rfkillglobalmutex via rfkillregister) is safe because during registration the device is not yet in rfkilllist, so no concurrent rfkill operations can occur on this device.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Fix the deadlock (ABBA) by storing the rfkill pointer in a local variable, then moving the rfkill_unregister() and rfkill_destroy() calls outside the device_lock(&dev->dev) critical section. Ensure rfkill_unregister() is invoked after releasing the device_lock(&dev->dev), and rely on the fact that rfkill_fop_write() holds rfkill_global_mutex while calling/handling operations so that the corrected lock ordering avoids inversion between device_lock and rfkill_global_mutex.
Linux kernel (net: nfc) rfkill_unregister() and rfkill_destroy() call placement relative to device_lock and rfkill_global_mutex = Move outside the device_lock critical section; store rfkill pointer in a local variable
Event History
Frequently Asked Questions
What is the severity of CVE-2025-71079?
The severity of CVE-2025-71079 is classified as moderate due to the potential for deadlock in the Linux kernel.
How do I fix CVE-2025-71079?
To fix CVE-2025-71079, it is recommended to update to the latest version of the Linux kernel that includes the patch for this deadlock issue.
What components are affected by CVE-2025-71079?
CVE-2025-71079 affects the NFC subsystem within the Linux kernel, specifically the functions related to NFC device registration and RF kill status.
What are the potential risks associated with CVE-2025-71079?
The potential risks of CVE-2025-71079 include application crashes or hang-ups due to deadlock conditions when interacting with NFC devices.
Who reported CVE-2025-71079?
CVE-2025-71079 was reported as a vulnerability in the Linux kernel related to the NFC subsystem.