bpf: Fix a potential use-after-free in bpf_link_free()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
| No fix yet |
| Linux Linux |
|
|
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.
From the CVE record · Linux
The Linux kernel can access a freed bpf_link in bpf_link_free() when a deferred deallocation frees it and the code subsequently checks its deallocation operation. The reported impact is a use-after-free; the input does not specify whether exploitation requires local access, authentication, or user interaction.
Teams running the Linux kernel should check their versions; affected versions are not specified.