CVE-2025-68372: nbd: defer config put in recv_work
In the Linux kernel, the following vulnerability has been resolved:
nbd: defer config put in recvwork
There is one uaf issue in recvwork when running NBDCLEARSOCK and NBDCMDRECONFIGURE: nbdgenlconnect // confref=2 (connect and recvwork A) nbdopen // confref=3 recvwork A done // confref=2 NBDCLEARSOCK // confref=1 nbdgenlreconfigure // confref=2 (trigger recvwork B) close nbd // confref=1 recvwork B configput // confref=0 atomicdec(&config->recvthreads); -> UAF
Or only running NBDCLEARSOCK: nbdgenlconnect // confref=2 nbdopen // confref=3 NBDCLEARSOCK // confref=2 close nbd nbdrelease configput // confref=1 recvwork configput // confref=0 atomicdec(&config->recvthreads); -> UAF
Commit 87aac3a80af5 ("nbd: call nbdconfigput() before notifying the waiter") moved nbdconfigput() to run before waking up the waiter in recvwork, in order to ensure that nbdstartdeviceioctl() would not be woken up while nbd->taskrecv was still uncleared.
However, in nbdstartdeviceioctl(), after being woken up it explicitly calls flushworkqueue() to make sure all current works are finished. Therefore, there is no need to move the config put ahead of the wakeup.
Move nbdconfigput() to the end of recvwork, so that the reference is held for the whole lifetime of the worker thread. This makes sure the config cannot be freed while recvwork is still running, even if clear + reconfigure interleave.
In addition, we don't need to worry about recvwork dropping the last nbdput (which causes deadlock):
path A (netlink with NBDCFLAGDESTROYONDISCONNECT): connect // nbdrefs=1 (trigger recvwork) open nbd // nbdrefs=2 NBDCLEARSOCK close nbd nbdrelease nbddisconnectandput flushworkqueue // recvwork done nbdconfigput nbdput // nbdrefs=1 nbdput // nbdrefs=0 queuework
path B (netlink without NBDCFLAGDESTROYONDISCONNECT): connect // nbdrefs=2 (trigger recvwork) open nbd // nbdrefs=3 NBDCLEARSOCK // confrefs=2 close nbd nbdrelease nbdconfigput // confrefs=1 nbdput // nbdrefs=2 recvwork done // confrefs=0, nbdrefs=1 rmmod // nbdrefs=0
Depends-on: e2daec488c57 ("nbd: Fix hungtask when nbdconfigput")
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Linux kernel (nbd)to a version that resolves this vulnerability.Patch 87aac3a80af5 - Upgrade
Upgrade
Linux kernel (nbd)to a version that resolves this vulnerability.Patch e2daec488c57
Event History
Frequently Asked Questions
What is the severity of CVE-2025-68372?
CVE-2025-68372 has been classified as having a high severity due to its potential impact on system stability.
How do I fix CVE-2025-68372?
To fix CVE-2025-68372, update your Linux kernel to the latest stable version where the vulnerability is patched.
What systems are affected by CVE-2025-68372?
CVE-2025-68372 affects the Linux kernel, specifically those utilizing the NBD (Network Block Device) protocol.
What are the potential consequences of CVE-2025-68372?
Exploitation of CVE-2025-68372 may lead to use-after-free conditions, potentially allowing for privilege escalation or system crashes.
How can I determine if my system is vulnerable to CVE-2025-68372?
To determine if your system is vulnerable to CVE-2025-68372, check the version of your Linux kernel against reported vulnerabilities.