From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Yang Li <yang.lee@linux.alibaba.com>,
Abaci Robot <abaci@linux.alibaba.com>,
Simon Horman <horms@kernel.org>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y 1/3] netfilter: nft_set_rbtree: Remove unused variable nft_net
Date: Tue, 1 Sep 2026 12:02:32 -0400 [thread overview]
Message-ID: <20260901160234.1283938-1-sashal@kernel.org> (raw)
In-Reply-To: <2026083157-seldom-action-9ebb@gregkh>
From: Yang Li <yang.lee@linux.alibaba.com>
[ Upstream commit 67059b61597c004e23b074547b40604222bee3a0 ]
The code that uses nft_net has been removed, and the nft_pernet function
is merely obtaining a reference to shared data through the net pointer.
The content of the net pointer is not modified or changed, so both of
them should be removed.
silence the warning:
net/netfilter/nft_set_rbtree.c:627:26: warning: variable ‘nft_net’ set but not used
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7103
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Stable-dep-of: 7904b94768e9 ("netfilter: nf_tables: don't queue packet path object notifications")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_tables_api.c | 28 +++++++++++++++-------------
net/netfilter/nft_set_rbtree.c | 2 --
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2c894a7d8a401..19c92fc457e4a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -922,11 +922,11 @@ nf_tables_chain_type_lookup(struct net *net, const struct nlattr *nla,
return ERR_PTR(-ENOENT);
}
-static __be16 nft_base_seq(const struct net *net)
+static unsigned int nft_base_seq(const struct net *net)
{
struct nftables_pernet *nft_net = nft_pernet(net);
- return htons(nft_net->base_seq & 0xffff);
+ return READ_ONCE(nft_net->base_seq);
}
static const struct nla_policy nft_table_policy[NFTA_TABLE_MAX + 1] = {
@@ -946,7 +946,7 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, family,
- NFNETLINK_V0, nft_base_seq(net));
+ NFNETLINK_V0, htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -1789,7 +1789,7 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, family,
- NFNETLINK_V0, nft_base_seq(net));
+ NFNETLINK_V0, htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -3398,7 +3398,7 @@ static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
u16 type = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, type, flags, family, NFNETLINK_V0,
- nft_base_seq(net));
+ htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -4593,7 +4593,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, ctx->family,
- NFNETLINK_V0, nft_base_seq(ctx->net));
+ NFNETLINK_V0,
+ htons(nft_base_seq(ctx->net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -5938,7 +5939,8 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb)
seq = cb->nlh->nlmsg_seq;
nlh = nfnl_msg_put(skb, portid, seq, event, NLM_F_MULTI,
- table->family, NFNETLINK_V0, nft_base_seq(net));
+ table->family, NFNETLINK_V0,
+ htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -6018,7 +6020,8 @@ static int nf_tables_fill_setelem_info(struct sk_buff *skb,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, ctx->family,
- NFNETLINK_V0, nft_base_seq(ctx->net));
+ NFNETLINK_V0,
+ htons(nft_base_seq(ctx->net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -7838,7 +7841,7 @@ static int nf_tables_fill_obj_info(struct sk_buff *skb, struct net *net,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, family,
- NFNETLINK_V0, nft_base_seq(net));
+ NFNETLINK_V0, htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -8205,9 +8208,8 @@ void nft_obj_notify(struct net *net, const struct nft_table *table,
struct nft_object *obj, u32 portid, u32 seq, int event,
u16 flags, int family, int report, gfp_t gfp)
{
- struct nftables_pernet *nft_net = nft_pernet(net);
char *buf = kasprintf(gfp, "%s:%u",
- table->name, nft_net->base_seq);
+ table->name, nft_base_seq(net));
audit_log_nfcfg(buf,
family,
@@ -8872,7 +8874,7 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net,
event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, event, flags, family,
- NFNETLINK_V0, nft_base_seq(net));
+ NFNETLINK_V0, htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
@@ -9119,7 +9121,7 @@ static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net,
int event = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWGEN);
nlh = nfnl_msg_put(skb, portid, seq, event, 0, AF_UNSPEC,
- NFNETLINK_V0, nft_base_seq(net));
+ NFNETLINK_V0, htons(nft_base_seq(net) & 0xffff));
if (!nlh)
goto nla_put_failure;
diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index 9c9b07f2def1b..91d677b692f7e 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -653,7 +653,6 @@ static void nft_rbtree_gc(struct nft_set *set)
{
struct nft_rbtree *priv = nft_set_priv(set);
struct nft_rbtree_elem *rbe, *rbe_end = NULL;
- struct nftables_pernet *nft_net;
struct net *net = read_pnet(&set->net);
u64 tstamp = nft_net_tstamp(net);
struct rb_node *node, *next;
@@ -661,7 +660,6 @@ static void nft_rbtree_gc(struct nft_set *set)
set = nft_set_container_of(priv);
net = read_pnet(&set->net);
- nft_net = nft_pernet(net);
gc = nft_trans_gc_alloc(set, 0, GFP_KERNEL);
if (!gc)
--
2.53.0
next prev parent reply other threads:[~2026-09-01 16:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:58 FAILED: patch "[PATCH] netfilter: nf_tables: don't queue packet path object" failed to apply to 6.6-stable tree gregkh
2026-09-01 16:02 ` Sasha Levin [this message]
2026-09-01 16:02 ` [PATCH 6.6.y 2/3] netfilter: nf_tables: place base_seq in struct net Sasha Levin
2026-09-01 16:02 ` [PATCH 6.6.y 3/3] netfilter: nf_tables: don't queue packet path object notifications Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901160234.1283938-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=abaci@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=pablo@netfilter.org \
--cc=stable@vger.kernel.org \
--cc=yang.lee@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.