[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231221022531.9772-1-hbh25y@gmail.com>
Date: Thu, 21 Dec 2023 10:25:31 +0800
From: Hangyu Hua <hbh25y@...il.com>
To: jhs@...atatu.com,
xiyou.wangcong@...il.com,
jiri@...nulli.us,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
tgraf@...g.ch
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Hangyu Hua <hbh25y@...il.com>
Subject: [PATCH v2] 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@...atatu.com>
Signed-off-by: Hangyu Hua <hbh25y@...il.com>
---
v2: fix a type usage error
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..f176afb70559 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(EM_TEXT_PRIV(m));
+ }
}
static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
--
2.34.1
Powered by blists - more mailing lists