CVE-2022-50241: NFSD: fix use-after-free on source server when doing inter-server copy
In the Linux kernel, the following vulnerability has been resolved:
NFSD: fix use-after-free on source server when doing inter-server copy
Use-after-free occurred when the laundromat tried to free expired cpntfstate entry on the s2scpstateids list after inter-server copy completed. The sccplist that the expired copy state was inserted on was already freed.
When COPY completes, the Linux client normally sends LOCKU(lockstate x), FREESTATEID(lockstate x) and CLOSE(openstate y) to the source server. The nfs4putstid call from nfsd4freestateid cleans up the copy state from the s2scpstateids list before freeing the lock state's stid.
However, sometimes the CLOSE was sent before the FREESTATEID request. When this happens, the nfsd4closeopenstateid call from nfsd4close frees all lock states on its stlocks list without cleaning up the copy state on the sccplist list. When the time the FREESTATEID arrives the server returns BADSTATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntfstate.
This patch adds a call to nfs4freecpntfstatelist in nfsd4closeopenstateid to clean up the copy state before calling freeolstateidreaplist to free the lock state's stid on the reaplist.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2022-50241?
CVE-2022-50241 has been assigned a high severity rating due to the possibility of a use-after-free vulnerability in the Linux kernel.
How do I fix CVE-2022-50241?
To fix CVE-2022-50241, update your Linux kernel to the latest version that includes the patch addressing this vulnerability.
What is a use-after-free vulnerability in CVE-2022-50241?
A use-after-free vulnerability, like in CVE-2022-50241, occurs when a program continues to use memory after it has been freed, potentially leading to arbitrary code execution.
Which systems are affected by CVE-2022-50241?
CVE-2022-50241 affects systems running specific versions of the Linux kernel that are susceptible to the identified use-after-free issue.
Is there a known exploit for CVE-2022-50241?
As of now, there are no publicly known exploits for CVE-2022-50241, but the vulnerability should be addressed promptly.