From nobody Sat Feb 7 09:37:42 2026 Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 771EC352927 for ; Wed, 28 Jan 2026 13:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769606105; cv=none; b=jGCg8jWp84AFpUqARve14WGVNTyISRLbvy7qbXpBcRzmzII9A/bvWAYh5s6eWRA3mNj6H9o+9wUnL16lsu9/2EAFwXkvscjG/EhpbbhFwZ9115l+XuC9rXOzvVKJj7GdlRHEC72gebQ9DTH2josfxtyMJsGCv7q7SuvCNKT2HVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769606105; c=relaxed/simple; bh=mmScjn9W3Q/046zuf7LL3Zj2ThZ/MPWQVHEMpteSkKg=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=HNEcrXIaLvDkEuyHh85qi7qx2OGlyjMNJ7dEZZxOAIYxIfuZgPhlbZ4c/YvIgU+zvrIGKlLq+SeHG7HwulL4G/+AaV+9zkxkOp8Ndefh1Ipfc1As4UEAqb1sNIGrrIZOoussbywpG2U/lXpeuqOnKTAfQL8rYPo8VPtV+3MpN6A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-6610d312bc3so21849298eaf.3 for ; Wed, 28 Jan 2026 05:15:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769606102; x=1770210902; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ECOckhBsGBqd3bE/3Ou1iDOLdK34+YidziWgcu3Jwu4=; b=HoTYBFLUr6OYt8I+KhZrIkDMLIiZTo81HQTPguMq2kVk+m+Hd77imhaOfMyEMRan6H exj5Ci74p6cKlulQiAMPbcKgQUmNspAh+lwFedQxbzBD2kJqx7e2uHhVT4gbulVPmrat th2NKGHjpXaX6SuP/AycpnWvNFhLlLLzCBPRnAy77fPxrB/EOOTZ2uoFtN1WwRreoxNb XGpwuTM+lZhlp6ShR5YqiGNq3DHmngd/WmGDnNWVY39QTu6UDqQ/f+793GmqBPrOAmFl E85Me4C0HuhH38VYjnDJJ8Z0Rbzfuy2WXDRLsqzAEGEBe4WJfrvnD1b2Qzp/Um+OEJYN UY2Q== X-Gm-Message-State: AOJu0Yy/67oft8/Jk+j+TZe1EhYFCZDEF41XF1quhC3Q8qk0Wd6lPFRB TdUaoM9lA0rAsBBGvpFykmIj12yP3hHEMgo0dUg3PsRErPOkXeeuXb2nTLOuYBoZPJwCcvSjqRD tyvmvAYyLi3vF2nG0Eom9FDWTLolstvb5lQJX40bzKVzLor88tDW4zLc4FBs= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:f027:b0:65c:fe1b:44c8 with SMTP id 006d021491bc7-662f2026eb1mr3520490eaf.10.1769606102451; Wed, 28 Jan 2026 05:15:02 -0800 (PST) Date: Wed, 28 Jan 2026 05:15:02 -0800 In-Reply-To: <6979fc44.050a0220.c9109.003b.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <697a0bd6.a70a0220.9914.0000.GAE@google.com> Subject: Forwarded: [PATCH] netfilter: nf_tables: fix use-after-free in nft_set_elem lookup From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] netfilter: nf_tables: fix use-after-free in nft_set_elem l= ookup Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.gi= t main Add RCU read-side critical section in nft_get_set_elem() to protect against concurrent element deletion by garbage collection. The lookup path in nft_rbtree_get() dereferences set elements through interval->from and interval->to pointers via nft_array_get_cmp(). These elements can be freed by nft_trans_gc_trans_free() running in an RCU callback context while the lookup is in progress, leading to a use-after-free. The crash occurs in nft_array_get_cmp() when it calls nft_set_ext_key() on a freed element: BUG: KASAN: slab-use-after-free in nft_array_get_cmp+0x1f6/0x2a0 Protect the element lookup with rcu_read_lock()/rcu_read_unlock() to ensure the RCU grace period extends until after we're done accessing the element data. This prevents the GC callback from freeing elements while they're being accessed. Reported-by: syzbot+d417922a3e7935517ef6@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Dd417922a3e7935517ef6 Signed-off-by: Deepanshu Kartikey --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index be4924aeaf0e..57affe22e0bd 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6540,7 +6540,10 @@ static int nft_get_set_elem(struct nft_ctx *ctx, con= st struct nft_set *set, return err; } =20 + rcu_read_lock(); err =3D nft_setelem_get(ctx, set, &elem, flags); + rcu_read_unlock(); + if (err < 0) return err; =20 --=20 2.43.0