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


- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 30 Nov 2026
- **Updated:** 30 Nov 2026
- **Also known as:** BELL-CVE-2026-139313, DEBIAN-CVE-2026-139313, GHSA-gw23-c93p-jx49, UBUNTU-CVE-2026-139313

## What is CVE-2026-139313?

CVE-2026-139313 is a vulnerability in Linux, published on 30 Nov 2026. 

### Official description

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

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

sk_clone() sets sk_refcnt of the new socket some lines behind
bpf_sk_storage_clone(). 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 sk_storage map hands the owner to its program.
bpf_sk_storage_get() with BPF_SK_STORAGE_GET_F_CREATE and
bpf_sk_storage_delete() rely on refcount_inc_not_zero() to tell whether
they may touch the socket.

sk_refcnt is in the part of struct sock which sock_copy() leaves out, and
sk_prot_alloc() does not clear a clone unless init_on_alloc 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
refcount_set() wipes out, and the helper's sock_put() 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 __raw_spin_lock_init+0x47/0x90

In the meantime the helper changes a storage which bpf_sk_storage_clone()
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.

## Which versions are affected by CVE-2026-139313?


## How do I fix CVE-2026-139313?

Upgrade to a fixed version.

## Is CVE-2026-139313 being exploited?

There is no known exploitation of CVE-2026-139313 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-139313 and fix it if it is affected.

What it is: CVE-2026-139313 is a vulnerability in Linux, published on 30 Nov 2026. 
Exploitation: There is no known exploitation of CVE-2026-139313 in the wild and no public exploit code.

Affected product: Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-139313/ (Markdown: https://insights.sbomify.com/CVE-2026-139313/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-139313
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-139313
- OSV: https://osv.dev/vulnerability/CVE-2026-139313

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-139313/
Summaries are generated and may contain mistakes; the official description above is the record.
