In the Linux kernel, the following vulnerability has been resolved:
net/smc: fix LGR and link use-after-free issue
We encountered a LGR/link use-after-free issue, which manifested as the LGR/link refcnt reaching 0 early and entering the clear process, making resource access unsafe.
refcountt: addition on 0; use-after-free. WARNING: CPU: 14 PID: 107447 at lib/refcount.c:25 refcountwarnsaturate+0x9c/0x140 Workqueue: events smclgrterminatework [smc] Call trace: refcountwarnsaturate+0x9c/0x140 _smclgrterminate.part.45+0x2a8/0x370 [smc] smclgrterminatework+0x28/0x30 [smc] processonework+0x1b8/0x420 worker_thread+0x158/0x510 kthread+0x114/0x118
or
refcountt: underflow; use-after-free. WARNING: CPU: 6 PID: 93140 at lib/refcount.c:28 refcountwarnsaturate+0xf0/0x140 Workqueue: smchswq smclistenwork [smc] Call trace: refcountwarnsaturate+0xf0/0x140 smcrlinkput+0x1cc/0x1d8 [smc] smcconnfree+0x110/0x1b0 [smc] smcconnabort+0x50/0x60 [smc] smclistenfinddevice+0x75c/0x790 [smc] smclistenwork+0x368/0x8a0 [smc] processonework+0x1b8/0x420 worker_thread+0x158/0x510 kthread+0x114/0x118
It is caused by repeated release of LGR/link refcnt. One suspect is that smcconnfree() is called repeatedly because some smcconnfree() from server listening path are not protected by sock lock.
e.g.
locksock(sk) | smcconnabort smcconnfree | - smcconnfree - smcrlinkput | - smcrlinkput (duplicated) releasesock(sk)
So here add sock lock protection in smclistenwork() path, making it exclusive with other connection operations.
[
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 2584.0,
"function_hash": "110875454990262672240790940552379789516"
},
"id": "CVE-2024-56640-24042e8d",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c7f14ed9c19ec0f149479d1c2842ec1f9bf76d7",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_work"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"334526204250590845825491124542963753352",
"113792541723722749731564876977839414900",
"134408797747237133414003494500986595449",
"48353959399874700372501859683329775479",
"29970762826638759295601890916138778909",
"339662856138526357053011822192899093877"
]
},
"id": "CVE-2024-56640-83c979bd",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@673d606683ac70bc074ca6676b938bff18635226",
"target": {
"file": "net/smc/af_smc.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"334526204250590845825491124542963753352",
"113792541723722749731564876977839414900",
"134408797747237133414003494500986595449",
"48353959399874700372501859683329775479",
"29970762826638759295601890916138778909",
"339662856138526357053011822192899093877"
]
},
"id": "CVE-2024-56640-881ca122",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c7f14ed9c19ec0f149479d1c2842ec1f9bf76d7",
"target": {
"file": "net/smc/af_smc.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 456.0,
"function_hash": "60375767218572022177721931974173110007"
},
"id": "CVE-2024-56640-9b2e9af3",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f502a88fdd415647a1f2dc45fac71b9c522a052b",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_out"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 456.0,
"function_hash": "60375767218572022177721931974173110007"
},
"id": "CVE-2024-56640-9b927e67",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@673d606683ac70bc074ca6676b938bff18635226",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_out"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 2229.0,
"function_hash": "94826511916860455545609956203141517886"
},
"id": "CVE-2024-56640-a4a26899",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f502a88fdd415647a1f2dc45fac71b9c522a052b",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_work"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 2574.0,
"function_hash": "308679181306706445345074753325970518194"
},
"id": "CVE-2024-56640-c992e655",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@673d606683ac70bc074ca6676b938bff18635226",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_work"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 456.0,
"function_hash": "60375767218572022177721931974173110007"
},
"id": "CVE-2024-56640-d045ff90",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0cf598548a6c36d90681d53c6b77d52363f2f295",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_out"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"334526204250590845825491124542963753352",
"113792541723722749731564876977839414900",
"134408797747237133414003494500986595449",
"48353959399874700372501859683329775479",
"29970762826638759295601890916138778909",
"339662856138526357053011822192899093877"
]
},
"id": "CVE-2024-56640-d6da69c5",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0cf598548a6c36d90681d53c6b77d52363f2f295",
"target": {
"file": "net/smc/af_smc.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 2272.0,
"function_hash": "171369803855897827304023427575286434715"
},
"id": "CVE-2024-56640-e15ba4c9",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0cf598548a6c36d90681d53c6b77d52363f2f295",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_work"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"334526204250590845825491124542963753352",
"113792541723722749731564876977839414900",
"134408797747237133414003494500986595449",
"29440749154628054369175105166909518893",
"31801789508612034357114791937911786474",
"339662856138526357053011822192899093877"
]
},
"id": "CVE-2024-56640-f7fe2fb7",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f502a88fdd415647a1f2dc45fac71b9c522a052b",
"target": {
"file": "net/smc/af_smc.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 456.0,
"function_hash": "60375767218572022177721931974173110007"
},
"id": "CVE-2024-56640-fce7c215",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c7f14ed9c19ec0f149479d1c2842ec1f9bf76d7",
"target": {
"file": "net/smc/af_smc.c",
"function": "smc_listen_out"
}
}
]