From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] netfilter: nf_tables: fix error code in nf_tables_updobj()
Date: Thu, 24 Feb 2022 18:01:30 +0300 [thread overview]
Message-ID: <20220224150130.GA6856@kili> (raw)
Set the error code to -ENOMEM instead of leaving it uninitialized.
Fixes: 33170d18fd2c ("netfilter: nf_tables: fix memory leak during stateful obj update")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This presumably goes through the netfilter tree.
net/netfilter/nf_tables_api.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 49060f281342..d0d2339e7c89 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -6558,8 +6558,10 @@ static int nf_tables_updobj(const struct nft_ctx *ctx,
trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
sizeof(struct nft_trans_obj));
- if (!trans)
+ if (!trans) {
+ err = -ENOMEM;
goto err_trans;
+ }
newobj = nft_obj_init(ctx, type, attr);
if (IS_ERR(newobj)) {
--
2.20.1
next reply other threads:[~2022-02-24 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 15:01 Dan Carpenter [this message]
2022-02-24 15:08 ` [PATCH] netfilter: nf_tables: fix error code in nf_tables_updobj() Florian Westphal
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=20220224150130.GA6856@kili \
--to=dan.carpenter@oracle.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).