# CVE-2026-139310: bpf: Hold the socket in the sk_storage map iterator

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.19%, higher than 9% of CVEs (2026-12-01)
- Published: 2026-11-30T13:33:34.331Z
- Modified: 2026-11-30T14:18:55.190Z
- Assigned by: Linux

## Description

In the Linux kernel, the following vulnerability has been resolved:

bpf: Hold the socket in the sk_storage map iterator

The iterator over a sk_storage map passes the owner of an element to its
program as ctx->sk, without a reference. All that it holds is the RCU read
lock, which keeps the element and the storage, not the socket.

An element is unlinked by bpf_sk_storage_free(), which __sk_destruct()
calls right before it frees the socket. That is no better for a socket
with SOCK_RCU_FREE: the grace period comes in front of __sk_destruct(),
so a reader which starts behind call_rcu() still finds the element. The
program and the helpers it hands ctx->sk to, such as
bpf_sk_storage_get() or bpf_sk_storage_delete(), use a socket which is
being freed on another CPU. It takes nothing but reading the iterator
while sockets with an element in the map are closed, by whomever.

Take a reference for the time of the program, and skip the element if
there is none to be had. To look at the owner at all, do what
bpf_selem_unlink_nofail() does for bpf_local_storage_map_free(): as long
as the element is linked under the lock of the storage,
bpf_local_storage_destroy() has not got past it, unless it has given up
on the lock, and then it waits for owner_refcnt.

The last reference may now be dropped by the iterator. The end of a socket
may want process context: rfcomm_sock_destruct() takes a mutex. So only
drop the reference under RCU, and free a socket whose last one it was when
the RCU read lock has been released, which is at the end of a bucket and
of every read() at the latest.

(As written by CVE List.)

## Affected

- Linux Linux: from c69d2ddb2072eb7ffca1a31ee5ddc16dcd414ed9 before 32370eec7c35c3d03df48e42b2bd35834d1af604; from c69d2ddb2072eb7ffca1a31ee5ddc16dcd414ed9 before 070a96b2a98f66087797d8a31d53126de7a5208f; 5.10 (not affected: before 5.10; from 7.3.6 up to 7.3.*; from 7.4-rc1 up to *)

## References

- <https://git.kernel.org/stable/c/32370eec7c35c3d03df48e42b2bd35834d1af604>
- <https://git.kernel.org/stable/c/070a96b2a98f66087797d8a31d53126de7a5208f>

## Sources

- CVE List: [CVE-2026-139310](https://www.cve.org/CVERecord?id=CVE-2026-139310), CVE Terms of Use, modified 2026-11-30
- NVD: [CVE-2026-139310](https://nvd.nist.gov/vuln/detail/CVE-2026-139310), Public domain, modified 2026-11-30

---

Page: https://cve.day/CVE-2026-139310 · Whole record: https://cve.day/CVE-2026-139310.json · Rebuilt by cve.day 2026-11-30T14:32:56.143Z
