netfilter: nfnetlink_cthelper: Fix memory leak
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Jeffy Chen
We have memory leaks of
nf_conntrack_helper&expect_policy.
Applied, thanks.
Pablo Neira Ayuso
maintainerQuoted 13 lines · Jeffy Chen
We have memory leaks of
nf_conntrack_helper&expect_policy.Signed-off-by Jeffy Chen <[email protected]>---
net/netfilter/nfnetlink_cthelper.c | 7 +++++++ 1 file changed, 7 insertions(+)net/netfilter/nfnetlink_cthelper.c +0
-0
net/netfilter/nfnetlink_cthelper.c nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper, · line 196
Quoted 6 lines
net/netfilter/nfnetlink_cthelper.c +2
-0@@ -191,6 +191,8 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,if (ret <0 ) goto err; } + +kfree (helper->expect_policy); helper->expect_policy = expect_policy;
This is fixing the leak, however this is not safe since a packet may be still walking on the older helper->expect_policy.
old_expect_policy = helper->expect_policy);
helper->expect_policy = expect_policy;
kfree(old_expect_policy);We need to protect this with RCU if we want to support expectation policy updates properly.
I'm going to take this patch, but we have to follow up on this.