CVE-2026-139313: bpf: Clear sk_refcnt of a clone before its storage is linked

Published Nov 30, 2026
·
Updated

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

bpf: Clear skrefcnt of a clone before its storage is linked

skclone() sets skrefcnt of the new socket some lines behind bpfskstorageclone(). But the elements which that function copies are linked to their maps at once, and an element leads to its owner: the iterator over a skstorage map hands the owner to its program. bpfskstorageget() with BPFSKSTORAGEGETFCREATE and bpfskstoragedelete() rely on refcountincnotzero() to tell whether they may touch the socket.

skrefcnt is in the part of struct sock which sockcopy() leaves out, and skprotalloc() does not clear a clone unless initonalloc is on. It is zero in an object which has been a socket before, and anything in one which has not. If it is not zero, a helper gets a reference which refcountset() wipes out, and the helper's sockput() then drops one of the two references of the new socket, which is freed too early:

IPv4: Attempt to release TCP socket in state 1 BUG: KASAN: slab-use-after-free in rawspinlockinit+0x47/0x90

In the meantime the helper changes a storage which bpfskstorageclone() fills without taking its lock.

Nothing else can find the clone at this point. Say that it is not alive yet, before the first element is linked. Sockets whose parent has no storage are left alone.

Affected Software

1 affected component
Linux Linux kernel

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

What activity is needed to trigger this issue?

The issue involves socket cloning while BPF socket-storage entries are being cloned and linked to their maps. A BPF program can be handed the socket through socket-storage map iteration and invoke bpf_sk_storage_get() with BPF_SK_STORAGE_GET_F_CREATE or bpf_sk_storage_delete() during that window.

2

How does memory initialization affect exposure?

The clone's sk_refcnt may contain a nonzero stale value because sock_copy() leaves that field out and sk_prot_alloc() does not clear a clone unless init_on_alloc is enabled. A nonzero value can allow a helper to take a reference that is later overwritten, leading to an early socket free.

3

What signs could indicate the issue has occurred?

Reported symptoms include an IPv4 attempt to release a TCP socket in state 1 and a KASAN slab-use-after-free report in __raw_spin_lock_init. The race can also allow a helper to modify socket storage while bpf_sk_storage_clone() populates it without taking the storage lock.

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