CVE-2025-21731

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-21731
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21731.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-21731
Downstream
Related
Published
2025-02-27T02:15:16Z
Modified
2025-08-09T19:01:26Z
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

nbd: don't allow reconnect after disconnect

Following process can cause nbd_config UAF:

1) grab nbd_config temporarily;

2) nbdgenldisconnect() flush all recv_work() and release the initial reference:

nbdgenldisconnect nbddisconnectandput nbddisconnect flushworkqueue(nbd->recvworkq) if (testandclearbit(NBDRTHASCONFIGREF, ...)) nbdconfig_put -> due to step 1), reference is still not zero

3) nbdgenlreconfigure() queue recv_work() again;

nbdgenlreconfigure config = nbdgetconfigunlocked(nbd) if (!config) -> succeed if (!testbit(NBDRTBOUND, ...)) -> succeed nbdreconnectsocket queuework(nbd->recvworkq, &args->work)

4) step 1) release the reference;

5) Finially, recv_work() will trigger UAF:

recvwork nbdconfigput(nbd) -> nbdconfig is freed atomicdec(&config->recvthreads) -> UAF

Fix the problem by clearing NBDRTBOUND in nbdgenldisconnect(), so that nbdgenlreconfigure() will fail.

References

Affected packages