From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>,
Stefano Brivio <sbrivio@redhat.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 2/7] netfilter: nft_set_pipapo: make pipapo_clone helper return NULL
Date: Thu, 23 Jul 2026 21:24:55 -0400 [thread overview]
Message-ID: <20260724012500.3832837-2-sashal@kernel.org> (raw)
In-Reply-To: <20260724012500.3832837-1-sashal@kernel.org>
From: Florian Westphal <fw@strlen.de>
[ Upstream commit 80efd2997fb9343a0283cf3cac5524a4595c8ff4 ]
Currently it returns an error pointer, but the only possible failure
is ENOMEM.
After a followup patch, we'd need to discard the errno code, i.e.
x = pipapo_clone()
if (IS_ERR(x))
return NULL
or make more changes to fix up callers to expect IS_ERR() code
from set->ops->deactivate().
So simplify this and make it return ptr-or-null.
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Stable-dep-of: 47e65eff5069 ("netfilter: nft_set_pipapo: don't leak bad clone into future transaction")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nft_set_pipapo.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index a01905381b5365..5f2885a878dda7 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -1318,7 +1318,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
* pipapo_clone() - Clone matching data to create new working copy
* @old: Existing matching data
*
- * Return: copy of matching data passed as 'old', error pointer on failure
+ * Return: copy of matching data passed as 'old' or NULL.
*/
static struct nft_pipapo_match *pipapo_clone(struct nft_pipapo_match *old)
{
@@ -1329,7 +1329,7 @@ static struct nft_pipapo_match *pipapo_clone(struct nft_pipapo_match *old)
new = kmalloc(sizeof(*new) + sizeof(*dst) * old->field_count,
GFP_KERNEL);
if (!new)
- return ERR_PTR(-ENOMEM);
+ return NULL;
new->field_count = old->field_count;
new->bsize_max = old->bsize_max;
@@ -1403,7 +1403,7 @@ static struct nft_pipapo_match *pipapo_clone(struct nft_pipapo_match *old)
free_percpu(new->scratch);
kfree(new);
- return ERR_PTR(-ENOMEM);
+ return NULL;
}
/**
@@ -1743,7 +1743,7 @@ static void nft_pipapo_commit(const struct nft_set *set)
goto out;
new_clone = pipapo_clone(priv->clone);
- if (IS_ERR(new_clone))
+ if (!new_clone)
goto out;
priv->dirty = false;
@@ -1769,7 +1769,7 @@ static void nft_pipapo_abort(const struct nft_set *set)
m = rcu_dereference(priv->match);
new_clone = pipapo_clone(m);
- if (IS_ERR(new_clone))
+ if (!new_clone)
return;
priv->dirty = false;
@@ -2214,8 +2214,8 @@ static int nft_pipapo_init(const struct nft_set *set,
/* Create an initial clone of matching data for next insertion */
priv->clone = pipapo_clone(m);
- if (IS_ERR(priv->clone)) {
- err = PTR_ERR(priv->clone);
+ if (!priv->clone) {
+ err = -ENOMEM;
goto out_free;
}
--
2.53.0
next prev parent reply other threads:[~2026-07-24 1:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 12:34 FAILED: patch "[PATCH] netfilter: nft_set_pipapo: don't leak bad clone into future" failed to apply to 5.10-stable tree gregkh
2026-07-24 1:24 ` [PATCH 5.10.y 1/7] netfilter: nft_set_pipapo: use GFP_KERNEL for insertions Sasha Levin
2026-07-24 1:24 ` Sasha Levin [this message]
2026-07-24 1:24 ` [PATCH 5.10.y 3/7] netfilter: nft_set_pipapo: prepare walk function for on-demand clone Sasha Levin
2026-07-24 1:24 ` [PATCH 5.10.y 4/7] netfilter: nft_set_pipapo: merge deactivate helper into caller Sasha Levin
2026-07-24 1:24 ` [PATCH 5.10.y 5/7] netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone Sasha Levin
2026-07-24 1:24 ` [PATCH 5.10.y 6/7] netfilter: nft_set_pipapo: move cloning of match info to insert/removal path Sasha Levin
2026-07-24 1:25 ` [PATCH 5.10.y 7/7] netfilter: nft_set_pipapo: don't leak bad clone into future transaction 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=20260724012500.3832837-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=fw@strlen.de \
--cc=pablo@netfilter.org \
--cc=sbrivio@redhat.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox