sctp: Fix null-ptr-deref in reuseport_add_sock().
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 6ba84574026792ce33a40c7da721dea36d0f3973 · < e809a84c802377ef61525a298a1ec1728759b913| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
sctp: Fix null-ptr-deref in reuseport_add_sock().
syzbot reported a null-ptr-deref while accessing sk2->sk_reuseport_cb in reuseport_add_sock(). [0]
The repro first creates a listener with SO_REUSEPORT. Then, it creates another listener on the same port and concurrently closes the first listener.
The second listen() calls reuseport_add_sock() with the first listener as sk2, where sk2->sk_reuseport_cb is not expected to be cleared concurrently, but the close() does clear it by reuseport_detach_sock().
The problem is SCTP does not properly synchronise reuseport_alloc(), reuseport_add_sock(), and reuseport_detach_sock().
The caller of reuseport_alloc() and reuseport_{add,detach}_sock() must provide synchronisation for sockets that are classified into the same reuseport group.
Otherwise, such sockets form multiple identical reuseport groups, and all groups except one would be silently dead.
From the CVE record · Linux
The Linux kernel’s SCTP reuseport handling lacks synchronization between socket setup and teardown. Concurrently listening on the same port and closing a listener can trigger a null-pointer dereference; concurrent listeners can also form duplicate reuseport groups, leaving some unable to receive packets. The described trigger uses local socket operations; the input does not specify authentication requirements.
Engineers running Linux kernels with SCTP support should check whether their kernel includes the fix; affected versions are not specified.