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 sccp_list 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 cpntf_state.
This patch adds a call to nfs4freecpntfstatelist in nfsd4closeopenstateid to clean up the copy state before calling freeolstateid_reaplist to free the lock state's stid on the reaplist.
[
{
"id": "CVE-2022-50241-10517196",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bbacfcde5fff25ac22597e8373a065c647da6738",
"digest": {
"line_hashes": [
"24478930952479137071489702820153499750",
"274347827166993946092187144985777065004",
"278197033795851093694408307047905799159",
"48361558945850148666372214843708597005",
"240623878598732325325808549257079911475",
"32407494824357882697034506918718959583",
"232640041947147293239597644909263450277",
"264744949503982803586225652139818935631",
"4299408962823858003887111735975956649",
"328680842827718671304963686648883832070",
"302163944339881134803057106549166144884",
"135111738448902779581043187155669640157",
"296688355452208603863408720725228687279",
"32856677243930266346847430862250559667",
"241418020876450481270419171230002218387",
"322684083584345683805256787365880420491"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2022-50241-173b02ea",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_ol_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83b94969751a691347606dbe6b1865efcfa5a643",
"digest": {
"length": 235.0,
"function_hash": "67607824317622242365367606313190444538"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-1995d0e0",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_deleg",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35aa0fb8c3033a3d78603356e96fc18c5b9cceb2",
"digest": {
"length": 110.0,
"function_hash": "246354642624107337896074438277763489232"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-3030ce78",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83b94969751a691347606dbe6b1865efcfa5a643",
"digest": {
"line_hashes": [
"24478930952479137071489702820153499750",
"274347827166993946092187144985777065004",
"278197033795851093694408307047905799159",
"48361558945850148666372214843708597005",
"240623878598732325325808549257079911475",
"32407494824357882697034506918718959583",
"232640041947147293239597644909263450277",
"264744949503982803586225652139818935631",
"4299408962823858003887111735975956649",
"328680842827718671304963686648883832070",
"302163944339881134803057106549166144884",
"135111738448902779581043187155669640157",
"296688355452208603863408720725228687279",
"32856677243930266346847430862250559667",
"241418020876450481270419171230002218387",
"322684083584345683805256787365880420491"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2022-50241-30de8fe0",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_ol_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6ea71246b7a02af675d733e72d14bd0d591d5f4a",
"digest": {
"length": 235.0,
"function_hash": "67607824317622242365367606313190444538"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-40b0ddf3",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_ol_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bbacfcde5fff25ac22597e8373a065c647da6738",
"digest": {
"length": 235.0,
"function_hash": "67607824317622242365367606313190444538"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-41454f1f",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfsd4_close_open_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83b94969751a691347606dbe6b1865efcfa5a643",
"digest": {
"length": 445.0,
"function_hash": "118764482742987726048335107687132164294"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-64424478",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_ol_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@019805fea91599b22dfa62ffb29c022f35abeb06",
"digest": {
"length": 235.0,
"function_hash": "67607824317622242365367606313190444538"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-714cee46",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_deleg",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@019805fea91599b22dfa62ffb29c022f35abeb06",
"digest": {
"length": 110.0,
"function_hash": "246354642624107337896074438277763489232"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-804e071e",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_deleg",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83b94969751a691347606dbe6b1865efcfa5a643",
"digest": {
"length": 110.0,
"function_hash": "246354642624107337896074438277763489232"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-8348d514",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35aa0fb8c3033a3d78603356e96fc18c5b9cceb2",
"digest": {
"line_hashes": [
"24478930952479137071489702820153499750",
"274347827166993946092187144985777065004",
"278197033795851093694408307047905799159",
"48361558945850148666372214843708597005",
"240623878598732325325808549257079911475",
"32407494824357882697034506918718959583",
"232640041947147293239597644909263450277",
"264744949503982803586225652139818935631",
"4299408962823858003887111735975956649",
"328680842827718671304963686648883832070",
"302163944339881134803057106549166144884",
"135111738448902779581043187155669640157",
"296688355452208603863408720725228687279",
"32856677243930266346847430862250559667",
"241418020876450481270419171230002218387",
"322684083584345683805256787365880420491"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2022-50241-93616f4f",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6ea71246b7a02af675d733e72d14bd0d591d5f4a",
"digest": {
"line_hashes": [
"24478930952479137071489702820153499750",
"274347827166993946092187144985777065004",
"278197033795851093694408307047905799159",
"48361558945850148666372214843708597005",
"240623878598732325325808549257079911475",
"32407494824357882697034506918718959583",
"232640041947147293239597644909263450277",
"264744949503982803586225652139818935631",
"4299408962823858003887111735975956649",
"328680842827718671304963686648883832070",
"302163944339881134803057106549166144884",
"135111738448902779581043187155669640157",
"296688355452208603863408720725228687279",
"32856677243930266346847430862250559667",
"241418020876450481270419171230002218387",
"322684083584345683805256787365880420491"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2022-50241-93abbbf9",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_ol_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35aa0fb8c3033a3d78603356e96fc18c5b9cceb2",
"digest": {
"length": 235.0,
"function_hash": "67607824317622242365367606313190444538"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-9766599d",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfsd4_close_open_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@019805fea91599b22dfa62ffb29c022f35abeb06",
"digest": {
"length": 445.0,
"function_hash": "118764482742987726048335107687132164294"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-9d5b9b83",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_deleg",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6ea71246b7a02af675d733e72d14bd0d591d5f4a",
"digest": {
"length": 110.0,
"function_hash": "246354642624107337896074438277763489232"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-a192c781",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfsd4_close_open_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bbacfcde5fff25ac22597e8373a065c647da6738",
"digest": {
"length": 445.0,
"function_hash": "118764482742987726048335107687132164294"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-a5e977bf",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfsd4_close_open_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@35aa0fb8c3033a3d78603356e96fc18c5b9cceb2",
"digest": {
"length": 445.0,
"function_hash": "118764482742987726048335107687132164294"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-cb7c63e4",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfsd4_close_open_stateid",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6ea71246b7a02af675d733e72d14bd0d591d5f4a",
"digest": {
"length": 445.0,
"function_hash": "118764482742987726048335107687132164294"
},
"signature_type": "Function"
},
{
"id": "CVE-2022-50241-d8f94e4a",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@019805fea91599b22dfa62ffb29c022f35abeb06",
"digest": {
"line_hashes": [
"24478930952479137071489702820153499750",
"274347827166993946092187144985777065004",
"278197033795851093694408307047905799159",
"48361558945850148666372214843708597005",
"240623878598732325325808549257079911475",
"32407494824357882697034506918718959583",
"232640041947147293239597644909263450277",
"264744949503982803586225652139818935631",
"4299408962823858003887111735975956649",
"328680842827718671304963686648883832070",
"302163944339881134803057106549166144884",
"135111738448902779581043187155669640157",
"296688355452208603863408720725228687279",
"32856677243930266346847430862250559667",
"241418020876450481270419171230002218387",
"322684083584345683805256787365880420491"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2022-50241-e2644341",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "nfs4_free_deleg",
"file": "fs/nfsd/nfs4state.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bbacfcde5fff25ac22597e8373a065c647da6738",
"digest": {
"length": 110.0,
"function_hash": "246354642624107337896074438277763489232"
},
"signature_type": "Function"
}
]