Thread (9 messages) flat view 9 messages, 4 authors, 2022-02-22

Re: [PATCH nf 5/5] netfilter: nf_tables: fix memory leak during stateful obj update

From: Florian Westphal <fw@strlen.de>
Date: 2022-02-22 06:57:56
Also in: netfilter-devel

Jakub Kicinski [off-list ref] wrote:
quoted
 static void nft_commit_release(struct nft_trans *trans)
@@ -8976,7 +8981,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 			break;
 		case NFT_MSG_NEWOBJ:
 			if (nft_trans_obj_update(trans)) {
-				kfree(nft_trans_obj_newobj(trans));
+				nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans));
 				nft_trans_destroy(trans);
 			} else {
 				trans->ctx.table->use--;
net/netfilter/nf_tables_api.c:6561:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (!trans)
            ^~~~~~
net/netfilter/nf_tables_api.c:6581:9: note: uninitialized use occurs here
        return err;
               ^~~
net/netfilter/nf_tables_api.c:6561:2: note: remove the 'if' if its condition is always false
        if (!trans)
        ^~~~~~~~~~~
net/netfilter/nf_tables_api.c:6554:9: note: initialize the variable 'err' to silence this warning
        int err;
               ^
I've sent a followup patch to this, no idea why gcc doesn't warn here.
Looks like I should dump it in favor of clang.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help