From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH net 6/8] netfilter: nftables: Fix a memleak from userdata error path in new objects
Date: Fri, 7 May 2021 19:47:37 +0200 [thread overview]
Message-ID: <20210507174739.1850-7-pablo@netfilter.org> (raw)
In-Reply-To: <20210507174739.1850-1-pablo@netfilter.org>
Release object name if userdata allocation fails.
Fixes: b131c96496b3 ("netfilter: nf_tables: add userdata support for nft_object")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_tables_api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 0b7fe0a902ff..926da6ed8d51 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -6615,9 +6615,9 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info,
INIT_LIST_HEAD(&obj->list);
return err;
err_trans:
- kfree(obj->key.name);
-err_userdata:
kfree(obj->udata);
+err_userdata:
+ kfree(obj->key.name);
err_strdup:
if (obj->ops->destroy)
obj->ops->destroy(&ctx, obj);
--
2.30.2
next prev parent reply other threads:[~2021-05-07 17:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 17:47 [PATCH net 0/8] Netfilter fixes for net Pablo Neira Ayuso
2021-05-07 17:47 ` [PATCH net 1/8] netfilter: xt_SECMARK: add new revision to fix structure layout Pablo Neira Ayuso
2021-05-07 23:20 ` patchwork-bot+netdevbpf
2021-05-07 17:47 ` [PATCH net 2/8] netfilter: arptables: use pernet ops struct during unregister Pablo Neira Ayuso
2021-05-07 17:47 ` [PATCH net 3/8] netfilter: nfnetlink: add a missing rcu_read_unlock() Pablo Neira Ayuso
2021-05-07 17:47 ` [PATCH net 4/8] netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check Pablo Neira Ayuso
2021-05-07 17:47 ` [PATCH net 5/8] netfilter: remove BUG_ON() after skb_header_pointer() Pablo Neira Ayuso
2021-05-07 17:47 ` Pablo Neira Ayuso [this message]
2021-05-07 17:47 ` [PATCH net 7/8] netfilter: nftables: avoid overflows in nft_hash_buckets() Pablo Neira Ayuso
2021-05-07 17:47 ` [PATCH net 8/8] netfilter: nftables: avoid potential overflows on 32bit arches Pablo Neira Ayuso
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=20210507174739.1850-7-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).