In the Linux kernel, the following vulnerability has been resolved:
tipc: fix a null-ptr-deref in tipctopsrvaccept
syzbot found a crash in tipctopsrvaccept:
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] Workqueue: tipcrcv tipctopsrvaccept RIP: 0010:kernelaccept+0x22d/0x350 net/socket.c:3487 Call Trace: <TASK> tipctopsrvaccept+0x197/0x280 net/tipc/topsrv.c:460 processonework+0x991/0x1610 kernel/workqueue.c:2289 workerthread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 retfromfork+0x1f/0x30 arch/x86/entry/entry64.S:306
It was caused by srv->listener that might be set to null by tipctopsrvstop() in net .exit whereas it's still used in tipctopsrvaccept() worker.
srv->listener is protected by srv->idrlock in tipctopsrvstop(), so add a check for srv->listener under srv->idrlock in tipctopsrvaccept() to avoid the null-ptr-deref. To ensure the lsock is not released during the tipctopsrvaccept(), move sockrelease() after tipctopsrvworkstop() where it's waiting until the tipctopsrvaccept worker to be done.
Note that skcallbacklock is used to protect sk->skuserdata instead of srv->listener, and it should check srv in tipctopsrvlistenerdataready() instead. This also ensures that no more tipctopsrvaccept worker will be started after tipcconnclose() is called in tipctopsrvstop() where it sets sk->skuserdata to null.
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@32a3d4660b34ce49ac0162338ebe362098e2f5df",
"id": "CVE-2022-50555-0e18e419",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7a939503fc32bff4ed60800b73ff7fbb4aea2142",
"id": "CVE-2022-50555-1914f49f",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24b129aed8730e48f47d852d58d76825ab6f407c",
"id": "CVE-2022-50555-2d37108f",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@32a3d4660b34ce49ac0162338ebe362098e2f5df",
"id": "CVE-2022-50555-389be126",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cedb41664e27b2cae7e21487f1bee22dcd84037d",
"id": "CVE-2022-50555-3a89e50d",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cedb41664e27b2cae7e21487f1bee22dcd84037d",
"id": "CVE-2022-50555-3b1f8ca8",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce69bdac2310152bb70845024d5d704c52aabfc3",
"id": "CVE-2022-50555-492be509",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82cb4e4612c633a9ce320e1773114875604a3cce",
"id": "CVE-2022-50555-53748a3b",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@32a3d4660b34ce49ac0162338ebe362098e2f5df",
"id": "CVE-2022-50555-6ffe8ee8",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82cb4e4612c633a9ce320e1773114875604a3cce",
"id": "CVE-2022-50555-8d4f78f7",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cedb41664e27b2cae7e21487f1bee22dcd84037d",
"id": "CVE-2022-50555-8d4fb54d",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7a939503fc32bff4ed60800b73ff7fbb4aea2142",
"id": "CVE-2022-50555-9363c7b2",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_accept",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 675.0,
"function_hash": "249803508437391207853075560005743972562"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@82cb4e4612c633a9ce320e1773114875604a3cce",
"id": "CVE-2022-50555-9522d193",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24b129aed8730e48f47d852d58d76825ab6f407c",
"id": "CVE-2022-50555-a85c53ee",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce69bdac2310152bb70845024d5d704c52aabfc3",
"id": "CVE-2022-50555-ab7ab6e1",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce69bdac2310152bb70845024d5d704c52aabfc3",
"id": "CVE-2022-50555-c196f4ca",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7a939503fc32bff4ed60800b73ff7fbb4aea2142",
"id": "CVE-2022-50555-cb1400f1",
"deprecated": false,
"signature_version": "v1",
"target": {
"function": "tipc_topsrv_listener_data_ready",
"file": "net/tipc/topsrv.c"
},
"signature_type": "Function",
"digest": {
"length": 242.0,
"function_hash": "141150598345898984548854293127418735474"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24b129aed8730e48f47d852d58d76825ab6f407c",
"id": "CVE-2022-50555-f49d1ad6",
"deprecated": false,
"signature_version": "v1",
"target": {
"file": "net/tipc/topsrv.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"331131595106710768606016166248309645106",
"311646711762343439277463096969768133624",
"273075811214008045728160742917026261980",
"116667652884131565532407537997911522537",
"181940170683080257709323907126926631243",
"142073141968545550055913041035743208087",
"200374198721993593463558310607998830435",
"266859307354793596329944922318807615293",
"304182552300932254925302240023550557493",
"30081785478642721723413165611199488337",
"130884117727830228858707122724937075509",
"319732357793168102314838706890584633068",
"149721919357124286969551006276754735370",
"233260663735623627577085867666817155949",
"21659883459835344737727516651916731731",
"256446969007975316281148196673075250303",
"251954974074292182161648641747615665532"
]
}
}
]