CVE-2025-39905: net: phylink: add lock for serializing concurrent pl->phydev writes with resolver
In the Linux kernel, the following vulnerability has been resolved:
net: phylink: add lock for serializing concurrent pl->phydev writes with resolver
Currently phylinkresolve() protects itself against concurrent phylinkbringupphy() or phylinkdisconnectphy() calls which modify pl->phydev by relying on pl->statemutex.
The problem is that in phylinkresolve(), pl->statemutex is in a lock inversion state with pl->phydev->lock. So pl->phydev->lock needs to be acquired prior to pl->statemutex. But that requires dereferencing pl->phydev in the first place, and without pl->statemutex, that is racy.
Hence the reason for the extra lock. Currently it is redundant, but it will serve a functional purpose once mutexlock(&phy->lock) will be moved outside of the mutexlock(&pl->statemutex) section.
Another alternative considered would have been to let phylinkresolve() acquire the rtnlmutex, which is also held when phylinkbringupphy() and phylinkdisconnectphy() are called. But since phylinkdisconnectphy() runs under rtnllock(), it would deadlock with phylinkresolve() when calling flushwork(&pl->resolve). Additionally, it would have been undesirable because it would have unnecessarily blocked many other call paths as well in the entire kernel, so the smaller-scoped lock was preferred.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-39905?
CVE-2025-39905 is classified as a moderate severity vulnerability affecting the Linux kernel.
How do I fix CVE-2025-39905?
To mitigate CVE-2025-39905, update your Linux kernel to the latest stable version that includes the security fix.
What products are affected by CVE-2025-39905?
CVE-2025-39905 affects the Linux kernel across various distributions.
What type of vulnerability is CVE-2025-39905?
CVE-2025-39905 is a race condition vulnerability within the phylink subsystem of the Linux kernel.
When was CVE-2025-39905 reported?
CVE-2025-39905 was publicly disclosed in the year 2025.