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: <CAMuHMdVYCsGDGeub8-mduNw45qX_tMr0sZ5oMNfJ_eqFnPgs4g@mail.gmail.com>
Date:   Tue, 3 Jan 2023 14:06:35 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Miaoqian Lin <linmq006@...il.com>
Cc:     Anton Ivanov <anton.ivanov@...bridgegreys.com>,
        Richard Weinberger <richard@....at>,
        Johannes Berg <johannes@...solutions.net>,
        Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        linux-um@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] um: vector: Fix memory leak in vector_config

Hi Miaoqian,

On Tue, Jan 3, 2023 at 1:17 PM Miaoqian Lin <linmq006@...il.com> wrote:
> On 2023/1/3 18:28, Anton Ivanov wrote:
> > On 03/01/2023 08:00, Geert Uytterhoeven wrote:
> >> On Thu, Dec 29, 2022 at 8:53 AM Miaoqian Lin <linmq006@...il.com> wrote:
> >>> kstrdup() return newly allocated copy of the string.
> >>> Call kfree() to release the memory when after use.
> >>>
> >>> Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
> >>> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> >> Thanks for your patch!
> >>
> >>> --- a/arch/um/drivers/vector_kern.c
> >>> +++ b/arch/um/drivers/vector_kern.c
> >>> @@ -765,6 +765,7 @@ static int vector_config(char *str, char **error_out)
> >>>
> >>>          parsed = uml_parse_vector_ifspec(params);
> >>>
> >>> +       kfree(params);
> >> Are you sure the memory pointed to by "params" is no longer used?
> >> "parsed" seems to contain pointers pointing to (parts of) the string
> >> pointed to by "params", so it cannot be freed.
> >
> > +1.
> >
> > I was just about to send the same comment.
> >
> Oh yes, thanks for spotting this. We should only perform release when uml_parse_vector_ifspec() fails (returns NULL). In this situation, 'params' is no longer used. Do you agree?

Yes, that sounds fine to me.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ