netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sched: em_text: fix possible memory leak in em_text_destroy()
@ 2023-12-20  3:08 Hangyu Hua
  2023-12-20 11:55 ` Jamal Hadi Salim
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hangyu Hua @ 2023-12-20  3:08 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, tgraf
  Cc: netdev, linux-kernel, Hangyu Hua

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

Fixes: d675c989ed2d ("[PKT_SCHED]: Packet classification based on textsearch (ematch)")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 net/sched/em_text.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sched/em_text.c b/net/sched/em_text.c
index 6f3c1fb2fb44..b9d5d4dca2c9 100644
--- a/net/sched/em_text.c
+++ b/net/sched/em_text.c
@@ -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(m->data);
+	}
 }
 
 static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-21  2:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-20  3:08 [PATCH] net: sched: em_text: fix possible memory leak in em_text_destroy() Hangyu Hua
2023-12-20 11:55 ` Jamal Hadi Salim
2023-12-20 16:05   ` Jamal Hadi Salim
2023-12-21  2:14     ` Hangyu Hua
2023-12-20 15:13 ` kernel test robot
2023-12-20 23:29 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).