lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a2634a6e-6630-4db7-8b66-81b315038f9e@gmail.com>
Date: Thu, 21 Dec 2023 10:14:09 +0800
From: Hangyu Hua <hbh25y@...il.com>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: xiyou.wangcong@...il.com, jiri@...nulli.us, davem@...emloft.net,
 edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, tgraf@...g.ch,
 netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: sched: em_text: fix possible memory leak in
 em_text_destroy()

On 21/12/2023 00:05, Jamal Hadi Salim wrote:
> On Wed, Dec 20, 2023 at 6:55 AM Jamal Hadi Salim <jhs@...atatu.com> wrote:
>>
>> Hi Hangyu,
>> While the fix looks correct - can you please describe how you came
>> across this issue? Was it a tool or by inspection? Do you have a text
>> case that triggered something etc, etc.

I discovered this accidentally when I used gdb to debug a program that 
uses em_text. And I think putting the code in the commit log will will 
make it too bulky.

>>
>> On Tue, Dec 19, 2023 at 10:09 PM Hangyu Hua <hbh25y@...il.com> wrote:
>>>
>>> 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@...il.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);
>>> +       }
>>>   }
>>>
>>
> 
> the bot just complained about needing a cast, use this:
> struct text_match *

I see. I will send a v2 later.

Thanks,
Hangyu

> 
> cheers,
> jamal
>> Acked-by: Jamal Hadi Salim <jhs@...atatu.com>
>>
>> cheers,
>> jamal
>>
>>>   static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
>>> --
>>> 2.34.1
>>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ