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

Published Nov 30, 2026
·
Updated

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

bpf: Hold the socket in the skstorage map iterator

The iterator over a skstorage 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 bpfskstoragefree(), which skdestruct() calls right before it frees the socket. That is no better for a socket with SOCKRCUFREE: the grace period comes in front of skdestruct(), so a reader which starts behind callrcu() still finds the element. The program and the helpers it hands ctx->sk to, such as bpfskstorageget() or bpfskstoragedelete(), 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 bpfselemunlinknofail() does for bpflocalstoragemapfree(): as long as the element is linked under the lock of the storage, bpflocalstoragedestroy() has not got past it, unless it has given up on the lock, and then it waits for ownerrefcnt.

The last reference may now be dropped by the iterator. The end of a socket may want process context: rfcommsockdestruct() 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.

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In the sk_storage map iterator, hold a reference to the socket for the duration of the BPF program so the socket remains alive while its owner is accessed.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:33 PM
Data Sourced
via MITRE·01:33 PM
Description
Data Sourced
via NVD·02:18 PM
Description

Frequently Asked Questions

1

Which systems are exposed to this issue?

Systems are exposed when a BPF program reads an iterator over an sk_storage map while sockets that have elements in that map are being closed. The issue concerns the iterator passing the socket owner to the program without holding a socket reference.

2

Does an attacker need to be the party closing the sockets?

No. The described race requires only that the iterator is read while relevant sockets are closed, and those sockets may be closed by any party. The vulnerable program or helpers can then use a socket that is being freed on another CPU.

3

How can I assess whether my environment uses the affected path?

Review deployed BPF programs for iteration over sk_storage maps and for use of ctx->sk or helpers such as bpf_sk_storage_get() and bpf_sk_storage_delete() from that iterator. The risk is present if those iterations can overlap with closure of sockets that have associated sk_storage elements.

4

What does the fix change?

The fix takes a reference to the socket for the duration of the iterator program's execution and skips an element when a reference cannot be obtained. This prevents the iterator program and related helpers from operating on a socket that is being freed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203