Skip to content

Commit 8fcb038

Browse files
HBh25Ydavem330
authored andcommitted
net: sched: em_text: fix possible memory leak in em_text_destroy()
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>
1 parent dcea1bd commit 8fcb038

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/sched/em_text.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ static int em_text_change(struct net *net, void *data, int len,
9797

9898
static void em_text_destroy(struct tcf_ematch *m)
9999
{
100-
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config)
100+
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) {
101101
textsearch_destroy(EM_TEXT_PRIV(m)->config);
102+
kfree(EM_TEXT_PRIV(m));
103+
}
102104
}
103105

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

0 commit comments

Comments
 (0)