Skip to content
/ linux Public

Commit c25e0de

Browse files
Florian Westphalgregkh
authored andcommitted
netfilter: bpf: defer hook memory release until rcu readers are done
[ Upstream commit 24f90fa ] Yiming Qian reports UaF when concurrent process is dumping hooks via nfnetlink_hooks: BUG: KASAN: slab-use-after-free in nfnl_hook_dump_one.isra.0+0xe71/0x10f0 Read of size 8 at addr ffff888003edbf88 by task poc/79 Call Trace: <TASK> nfnl_hook_dump_one.isra.0+0xe71/0x10f0 netlink_dump+0x554/0x12b0 nfnl_hook_get+0x176/0x230 [..] Defer release until after concurrent readers have completed. Reported-by: Yiming Qian <yimingqian591@gmail.com> Fixes: 84601d6 ("bpf: add bpf_link support for BPF_NETFILTER programs") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 017d674 commit c25e0de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nf_bpf_link.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int bpf_nf_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
170170

171171
static const struct bpf_link_ops bpf_nf_link_lops = {
172172
.release = bpf_nf_link_release,
173-
.dealloc = bpf_nf_link_dealloc,
173+
.dealloc_deferred = bpf_nf_link_dealloc,
174174
.detach = bpf_nf_link_detach,
175175
.show_fdinfo = bpf_nf_link_show_info,
176176
.fill_link_info = bpf_nf_link_fill_link_info,

0 commit comments

Comments
 (0)