CVE-2022-50555: tipc: fix a null-ptr-deref in tipc_topsrv_accept
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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Update the Linux kernel TIPC topsrv code so that tipc_topsrv_accept() checks srv->listener under srv->idr_lock before using it, preventing a null-ptr-deref crash in the tipc_topsrv_accept workqueue worker.
Linux kernel (tipc_topsrv_accept worker in net/tipc/topsrv.c) srv->listener null-check under srv->idr_lock in tipc_topsrv_accept() = Add a check for srv->listener under srv->idr_lock in tipc_topsrv_accept() to avoid null-ptr-deref - Configuration
Update the Linux kernel TIPC topsrv stop/accept logic so sock_release() is moved after tipc_topsrv_work_stop(), ensuring the lsock is not released while the tipc_topsrv_accept worker is still using it.
Linux kernel (tipc_topsrv_accept / tipc_topsrv_work_stop sequencing in net/tipc/topsrv.c) sock_release() call position relative to tipc_topsrv_work_stop() = Move sock_release() after tipc_topsrv_work_stop()
Event History
Frequently Asked Questions
What is the severity of CVE-2022-50555?
CVE-2022-50555 is classified as a high severity vulnerability due to a null pointer dereference in the Linux kernel.
How do I fix CVE-2022-50555?
To fix CVE-2022-50555, update your Linux kernel to the latest patched version that addresses this vulnerability.
What systems are affected by CVE-2022-50555?
CVE-2022-50555 affects the Linux kernel across various distributions and versions.
What impact does CVE-2022-50555 have on system stability?
CVE-2022-50555 can cause system crashes, leading to instability and potential denial of service.
How was CVE-2022-50555 discovered?
CVE-2022-50555 was discovered through fuzz testing by the syzbot tool which identified the null pointer dereference.