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, 1 Sep 2015 12:35:46 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Colin King <colin.king@...onical.com>
Cc:	Geoff Levand <geoff@...radead.org>,
	"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ps3-vuart: BUG_ON on null drv before dereferencing it on dev_dbg

Hi Colin,

On Tue, Sep 1, 2015 at 12:21 PM, Colin King <colin.king@...onical.com> wrote:
> On the unlikely event that drv is null, the current code will
> perform a null pointer dereference with it when printing a dev_dbg
> message.  Instead, the BUG_ON check on drv should be performed
> before we emit the dev_dbg message.

What about just removing the BUG_ON()?

The system will crash anyway, providing a backtrace.

> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/ps3/ps3-vuart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
> index d6db822..632701a 100644
> --- a/drivers/ps3/ps3-vuart.c
> +++ b/drivers/ps3/ps3-vuart.c
> @@ -1000,12 +1000,11 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
>         dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__);
>
>         drv = ps3_system_bus_dev_to_vuart_drv(dev);
> +       BUG_ON(!drv);
>
>         dev_dbg(&dev->core, "%s:%d: (%s)\n", __func__, __LINE__,
>                 drv->core.core.name);
>
> -       BUG_ON(!drv);
> -
>         if (dev->port_number >= PORT_COUNT) {
>                 BUG();
>                 return -EINVAL;


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ