[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <697a231c.a70a0220.8545c.0002.GAE@google.com>
Date: Wed, 28 Jan 2026 06:54:20 -0800
From: syzbot <syzbot+d417922a3e7935517ef6@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] netfilter: nf_tables: add missing RCU read lock in nf_tables_getsetelem
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: [PATCH] netfilter: nf_tables: add missing RCU read lock in nf_tables_getsetelem
Author: kartikey406@...il.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main
Add RCU read-side critical section in nf_tables_getsetelem() to protect
against concurrent element deletion by garbage collection.
The function nf_tables_getsetelem() calls nft_get_set_elem() which
eventually dereferences set elements through the rbtree lookup path.
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 function nf_tables_getsetelem_reset() already has proper RCU
protection around the same code path. This patch adds the missing RCU
read lock to nf_tables_getsetelem() to match.
Reported-by: syzbot+d417922a3e7935517ef6@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d417922a3e7935517ef6
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>
---
net/netfilter/nf_tables_api.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index be4924aeaf0e..00af242b1e62 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -6628,6 +6628,7 @@ static int nf_tables_getsetelem(struct sk_buff *skb,
if (err)
return err;
+ rcu_read_lock();
nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) {
err = nft_get_set_elem(&dump_ctx.ctx, dump_ctx.set, attr, false);
if (err < 0) {
@@ -6635,6 +6636,7 @@ static int nf_tables_getsetelem(struct sk_buff *skb,
break;
}
}
+ rcu_read_unlock();
return err;
}
--
2.43.0
Powered by blists - more mailing lists