Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B77723AE6E7 for ; Tue, 17 Mar 2026 11:50:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773748206; cv=none; b=UnNVJ5OxTaNoS68rjDXLlrM+qNz2lDYPw5w9lpl1JcKFJhasHk5yAWn4vypa/l2Gv3l9UjOm5aFMsHVeGVqcTyg9axI/wYh4Oc6fkO0bU1qOMBWNtUXZESmPlD4fBzBAO1NV7l3l+sRXRmH2iI/mEy2eD9VO6rtGjbCwvM8mCVo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773748206; c=relaxed/simple; bh=XAadaQyYMoAWVnvWU53k2VGwog6L4zz6uXLPI2Yp1RE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BeTubjwfcQlu+ipnQrhao6yZaWKeHx87KRYAFKog369ZlS77dzmKnGKYN0NkZqCv9vhimAO7zWxSRQ1TqvnH19yeWqiA/LaO3cZsLBj0g13Nj8nccJsaWre+1xS/auq4Rq0sJa4bkDmwSvr3Q3Cx/TYg9PIiodsNH6UL3sv/OV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id 68424609F0; Tue, 17 Mar 2026 12:49:56 +0100 (CET) From: Florian Westphal To: Cc: Florian Westphal , Yiming Qian Subject: [PATCH nf] netfilter: bpf: defer hook memory release until rcu readers are done Date: Tue, 17 Mar 2026 12:49:49 +0100 Message-ID: <20260317114951.20984-1-fw@strlen.de> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 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 Fixes: 84601d6ee68a ("bpf: add bpf_link support for BPF_NETFILTER programs") Signed-off-by: Florian Westphal --- net/netfilter/nf_bpf_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_bpf_link.c b/net/netfilter/nf_bpf_link.c index 6f3a6411f4af..c20031891b86 100644 --- a/net/netfilter/nf_bpf_link.c +++ b/net/netfilter/nf_bpf_link.c @@ -170,7 +170,7 @@ static int bpf_nf_link_update(struct bpf_link *link, struct bpf_prog *new_prog, static const struct bpf_link_ops bpf_nf_link_lops = { .release = bpf_nf_link_release, - .dealloc = bpf_nf_link_dealloc, + .dealloc_deferred = bpf_nf_link_dealloc, .detach = bpf_nf_link_detach, .show_fdinfo = bpf_nf_link_show_info, .fill_link_info = bpf_nf_link_fill_link_info, -- 2.52.0