CVE-2025-40249: gpio: cdev: make sure the cdev fd is still active before emitting events
In the Linux kernel, the following vulnerability has been resolved:
gpio: cdev: make sure the cdev fd is still active before emitting events
With the final call to fput() on a file descriptor, the release action may be deferred and scheduled on a work queue. The reference count of that descriptor is still zero and it must not be used. It's possible that a GPIO change, we want to notify the user-space about, happens AFTER the reference count on the file descriptor associated with the character device went down to zero but BEFORE the .release() callback was called from the workqueue and so BEFORE we unregistered from the notifier.
Using the regular getfile() routine in this situation triggers the following warning:
struct file::fcount incremented from zero; use-after-free condition present!
So use the getfileactive() variant that will return NULL on file descriptors that have been or are being released.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-40249?
CVE-2025-40249 has been classified with a medium severity rating.
How do I fix CVE-2025-40249?
To fix CVE-2025-40249, update your Linux kernel to the latest version that includes the security patch.
What systems are affected by CVE-2025-40249?
CVE-2025-40249 affects various versions of the Linux kernel.
What are the potential impacts of CVE-2025-40249?
Exploitation of CVE-2025-40249 may lead to issues with file descriptor management and event emission.
Is CVE-2025-40249 actively being exploited?
As of now, there is no public knowledge of active exploitation for CVE-2025-40249.