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:   Mon, 11 Mar 2019 08:43:35 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Kangjie Lu <kjlu@....edu>
Cc:     pakki001@....edu,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        "David S. Miller" <davem@...emloft.net>,
        Vladimir Zapolskiy <vladimir_zapolskiy@...tor.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Vladimir Barinov <vladimir.barinov@...entembedded.com>,
        Chris Brandt <chris.brandt@...esas.com>,
        netdev <netdev@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: renesas: fix a potential NULL pointer dereference

Hi Kangjie,

On Mon, Mar 11, 2019 at 8:01 AM Kangjie Lu <kjlu@....edu> wrote:
> In case of_get_phy_mode fails, the fix returns NULL to avoid
> the NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>

Thanks for your patch!

> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3187,6 +3187,8 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
>                 return NULL;
>
>         pdata->phy_interface = of_get_phy_mode(np);
> +       if (unlikely(!pdata->phy_interface))
> +               return NULL;

of_get_phy_mode() does not return a pointer, but a phy mode index.
Hence zero is a valid value.

So I'm wondering where is the potential NULL pointer dereference?

Perhaps we do need to check for negative error codes?
Or is this already handled later, by {of_,}phy_connect()?

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