CVE-2021-46929 json
sctp: use call_rcu to free endpoint
published 2024-02-27 2 y ago modified 2026-08-05 3 mo ago also EUVD-2021-33577
- cvss
- 7.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.3%
- EPSS 0.3% chance of exploitation in 30 days, percentile 17%
- public exploits
- 0
- none known
Summary
In the Linux kernel, the following vulnerability has been resolved:
sctp: use call_rcu to free endpoint
This patch is to delay the endpoint free by calling call_rcu() to fix another use-after-free issue in sctp_sock_dump():
BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20 Call Trace: __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218 lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:334 [inline] __lock_sock+0x203/0x350 net/core/sock.c:2253 lock_sock_nested+0xfe/0x120 net/core/sock.c:2774 lock_sock include/net/sock.h:1492 [inline] sctp_sock_dump+0x122/0xb20 net/sctp/diag.c:324 sctp_for_each_transport+0x2b5/0x370 net/sctp/socket.c:5091 sctp_diag_dump+0x3ac/0x660 net/sctp/diag.c:527 __inet_diag_dump+0xa8/0x140 net/ipv4/inet_diag.c:1049 inet_diag_dump+0x9b/0x110 net/ipv4/inet_diag.c:1065 netlink_dump+0x606/0x1080 net/netlink/af_netlink.c:2244 __netlink_dump_start+0x59a/0x7c0 net/netlink/af_netlink.c:2352 netlink_dump_start include/linux/netlink.h:216 [inline] inet_diag_handler_cmd+0x2ce/0x3f0 net/ipv4/inet_diag.c:1170 __sock_diag_cmd net/core/sock_diag.c:232 [inline] sock_diag_rcv_msg+0x31d/0x410 net/core/sock_diag.c:263 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2477 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:274
This issue occurs when asoc is peeled off and the old sk is freed after getting it by asoc->base.sk and before calling lock_sock(sk).
To prevent the sk free, as a holder of the sk, ep should be alive when calling lock_sock(). This patch uses call_rcu() and moves sock_put and ep free into sctp_endpoint_destroy_rcu(), so that it's safe to try to hold the ep under rcu_read_lock in sctp_transport_traverse_process().
If sctp_endpoint_hold() returns true, it means this ep is still alive and we have held it and can continue to dump it; If it returns false, it means this ep is dead and can be freed after rcu_read_unlock, and we should skip it.
In sctp_sock_dump(), after locking the sk, if this ep is different from tsp->asoc->ep, it means during this dumping, this asoc was peeled off before calling lock_sock(), and the sk should be skipped; If this ep is the same with tsp->asoc->ep, it means no peeloff happens on this asoc, and due to lock_sock, no peeloff will happen either until release_sock.
Note that delaying endpoint free won't delay the port release, as the port release happens in sctp_endpoint_destroy() before calling call_rcu(). Also, freeing endpoint by call_rcu() makes it safe to access the sk by asoc->base.sk in sctp_assocs_seq_show() and sctp_rcv().
Thanks Jones to bring this issue up.
v1->v2: - improve the changelog. - add kfree(ep) into sctp_endpoint_destroy_rcu(), as Jakub noticed.
Patch / fix
- Linux Linux 4.14.261, 4.19.224, 5.4.170, 5.10.90, 5.15.13, 5.16
- linux Debian 14, Debian 13, Debian 12 5.15.15-1
debian advisories DEBIAN-CVE-2021-46929
- linux Ubuntu 18.04 LTS 4.15.0-173.182
- linux Ubuntu 20.04 LTS 5.4.0-105.119
- linux-aws Ubuntu 18.04 LTS 4.15.0-1124.133
- linux-aws Ubuntu 20.04 LTS 5.4.0-1069.73
- linux-gcp Ubuntu 20.04 LTS 5.4.0-1068.72
- linux-ibm Ubuntu 20.04 LTS 5.4.0-1018.20
- linux-kvm Ubuntu 18.04 LTS 4.15.0-1110.113
- linux-kvm Ubuntu 20.04 LTS 5.4.0-1059.62
ubuntu advisories UBUNTU-CVE-2021-46929
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- kernel-azure SLE Module for Public Cloud 15 SP5, openSUSE Leap 15.5 5.14.21-150500.33.48.1
- kernel-syms-azure SLE Module for Public Cloud 15 SP5, openSUSE Leap 15.5 5.14.21-150500.33.48.1
- kernel-source-azure SLE Module for Public Cloud 15 SP5, openSUSE Leap 15.5 5.14.21-150500.33.48.1
- dtb-aarch64 openSUSE Leap 15.5 5.14.21-150500.55.59.1
- kernel-64kb SLE Module for Basesystem 15 SP5, openSUSE Leap 15.5 5.14.21-150500.55.59.1
- kernel-syms SLE Module for Development Tools 15 SP5, openSUSE Leap 15.5 5.14.21-150500.55.59.1
- kernel-obs-qa openSUSE Leap 15.5 5.14.21-150500.55.59.1
- kernel-source SLE Module for Development Tools 15 SP5, SLE Module for Basesystem 15 SP5, openSUSE Leap 15.5 5.14.21-150500.55.59.1
suse advisories SUSE-SU-2024:1490-1SUSE-SU-2024:1480-1SUSE-SU-2024:1466-1SUSE-SU-2024:1321-1SUSE-SU-2024:1320-1SUSE-SU-2024:0976-1
- git.kernel.org/stable/c/8873140f95d4977bf37e4cf0d5c5e3f6e34cdd3e commit
- git.kernel.org/stable/c/af6e6e58f7ebf86b4e7201694b1e4f3a62cbc3ec commit
- git.kernel.org/stable/c/831de271452b87657fcf8d715ee20519b79caef5 commit
- git.kernel.org/stable/c/769d14abd35e0e153b5149c3e1e989a9d719e3ff commit
- git.kernel.org/stable/c/75799e71df1da11394740b43ae5686646179561d commit
- git.kernel.org/stable/c/5ec7d18d1813a5bead0b495045606c93873aecbb commit
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-46929 updated cvss 5.5
kernel: sctp: use call_rcu to free endpoint
-
Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 moreaffected: no fix planned “Out of support scope”
-
Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 moreaffected: no fix available
-
Red Hat Enterprise Linux 9 rv, perf, rtla, kernel, bpftool, libperf, +82 morenot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 2 y ago
Exploit prediction
0.26% chance of exploitation in the next 30 days, higher than 17% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 3.1 | 5.5 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Affected products
- Linux Linux
Classification
- Weakness
-
- CWE-416 Use After Free
- Technology feeds
References
-
git.kernel.org
/stable/c/8873140f95d4977bf37e4cf0d5c5e3f6e34cdd3e
patch
-
git.kernel.org
/stable/c/af6e6e58f7ebf86b4e7201694b1e4f3a62cbc3ec
patch
-
git.kernel.org
/stable/c/831de271452b87657fcf8d715ee20519b79caef5
patch
-
git.kernel.org
/stable/c/769d14abd35e0e153b5149c3e1e989a9d719e3ff
patch
-
git.kernel.org
/stable/c/75799e71df1da11394740b43ae5686646179561d
patch
-
git.kernel.org
/stable/c/5ec7d18d1813a5bead0b495045606c93873aecbb
patch
Sources
- CVE List CVE-2021-46929
- NVD CVE-2021-46929
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.