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
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 <[email protected]>
Signed-off-by: Hangyu Hua <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
HBh25Y authored and davem330 committed Jan 1, 2024
1 parent dcea1bd commit 8fcb038
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 8fcb038

Please sign in to comment.