Skip to content

Commit

Permalink
net: sched: em_text: fix possible memory leak in em_text_destroy()
Browse files Browse the repository at this point in the history
[ Upstream commit 8fcb038 ]

m->data needs to be freed when em_text_destroy is called.

Fixes: d675c98 ("[PKT_SCHED]: Packet classification based on textsearch (ematch)")
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
HBh25Y authored and gregkh committed Jan 10, 2024
1 parent 463fe69 commit 4083c9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sched/em_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ static int em_text_change(struct net *net, void *data, int len,

static void em_text_destroy(struct tcf_ematch *m)
{
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config)
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) {
textsearch_destroy(EM_TEXT_PRIV(m)->config);
kfree(EM_TEXT_PRIV(m));
}
}

static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
Expand Down

0 comments on commit 4083c9b

Please sign in to comment.