Skip to content

Commit 9dd732e

Browse files
committed
netfilter: nf_tables: memleak flow rule from commit path
Abort path release flow rule object, however, commit path does not. Update code to destroy these objects before releasing the transaction. Fixes: c9626a2 ("netfilter: nf_tables: add hardware offload support") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent c271cc9 commit 9dd732e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8329,6 +8329,9 @@ static void nft_commit_release(struct nft_trans *trans)
83298329
nf_tables_chain_destroy(&trans->ctx);
83308330
break;
83318331
case NFT_MSG_DELRULE:
8332+
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8333+
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
8334+
83328335
nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans));
83338336
break;
83348337
case NFT_MSG_DELSET:
@@ -8817,6 +8820,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
88178820
nf_tables_rule_notify(&trans->ctx,
88188821
nft_trans_rule(trans),
88198822
NFT_MSG_NEWRULE);
8823+
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8824+
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
8825+
88208826
nft_trans_destroy(trans);
88218827
break;
88228828
case NFT_MSG_DELRULE:

0 commit comments

Comments
 (0)