[PATCH] netfilter: nf_tables: fix error code in nf_tables_updobj()

Subsystems: netfilter, networking [general], the rest

STALE1656d

2 messages, 2 authors, 2022-02-24 · open the first message on its own page

[PATCH] netfilter: nf_tables: fix error code in nf_tables_updobj()

From: Dan Carpenter <hidden>
Date: 2022-02-24 15:02:08

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 <redacted>
---
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

Re: [PATCH] netfilter: nf_tables: fix error code in nf_tables_updobj()

From: Florian Westphal <fw@strlen.de>
Date: 2022-02-24 15:08:23

Dan Carpenter [off-list ref] wrote:
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 <redacted>
Correct, but this commit no longer exists, it was replaced by
dad3bdeef45f81a6e90204bcc85360bb76eccec7,
"netfilter: nf_tables: fix memory leak during stateful obj update"

... which sets err to -ENOMEM.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help