Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: d675c989ed2d ("[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>

authored by

Hangyu Hua and committed by
David S. Miller
8fcb0382 dcea1bd4

+3 -1
+3 -1
net/sched/em_text.c
··· 97 97 98 98 static void em_text_destroy(struct tcf_ematch *m) 99 99 { 100 - if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) 100 + if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) { 101 101 textsearch_destroy(EM_TEXT_PRIV(m)->config); 102 + kfree(EM_TEXT_PRIV(m)); 103 + } 102 104 } 103 105 104 106 static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)