提交 8ebdb93a 编写于 作者: P Pablo Neira Ayuso 提交者: Zheng Zengkai

netfilter: nf_tables: memleak flow rule from commit path

stable inclusion
from stable-v5.10.122
commit 330c0c6cd2150a2d7f47af16aa590078b0d2f736
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5W6OE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=330c0c6cd2150a2d7f47af16aa590078b0d2f736

--------------------------------

[ Upstream commit 9dd732e0 ]

Abort path release flow rule object, however, commit path does not.
Update code to destroy these objects before releasing the transaction.

Fixes: c9626a2c ("netfilter: nf_tables: add hardware offload support")
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 0abdae69
...@@ -7601,6 +7601,9 @@ static void nft_commit_release(struct nft_trans *trans) ...@@ -7601,6 +7601,9 @@ static void nft_commit_release(struct nft_trans *trans)
nf_tables_chain_destroy(&trans->ctx); nf_tables_chain_destroy(&trans->ctx);
break; break;
case NFT_MSG_DELRULE: case NFT_MSG_DELRULE:
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans)); nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans));
break; break;
case NFT_MSG_DELSET: case NFT_MSG_DELSET:
...@@ -7960,6 +7963,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) ...@@ -7960,6 +7963,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
nf_tables_rule_notify(&trans->ctx, nf_tables_rule_notify(&trans->ctx,
nft_trans_rule(trans), nft_trans_rule(trans),
NFT_MSG_NEWRULE); NFT_MSG_NEWRULE);
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
nft_trans_destroy(trans); nft_trans_destroy(trans);
break; break;
case NFT_MSG_DELRULE: case NFT_MSG_DELRULE:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册