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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Mar 2019 14:47:01 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Miguel Ojeda Sandonis <miguel.ojeda.sandonis@...il.com>,
        Willy Tarreau <willy@...roxy.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 1/4] auxdisplay: hd44780: Fix memory leak on ->remove()

Hi Andy,

On Tue, Mar 12, 2019 at 2:18 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> We have to free on ->remove() the allocated resources on ->probe().
>
> Fixes: d47d88361fee ("auxdisplay: Add HD44780 Character LCD support")
> Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Thanks, nice catch!

> --- a/drivers/auxdisplay/hd44780.c
> +++ b/drivers/auxdisplay/hd44780.c
> @@ -280,6 +280,8 @@ static int hd44780_remove(struct platform_device *pdev)
>         struct charlcd *lcd = platform_get_drvdata(pdev);
>
>         charlcd_unregister(lcd);
> +
> +       kfree(lcd);

(wearing a newer (and hopefully wiser ;-) hat than when I wrote the code)

While this is correct for the current implementation of struct charlcd_priv,
this may be a bit fragile.

What about adding a charlcd_free() wrapper, which can do kfree(to_priv(lcd)),
and be used in the probe failure path, too?

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