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-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXLTmJt6vKt-E-h2nzWdvv0Rw6J=vLbg55owK_-CRCiiw@mail.gmail.com>
Date:   Tue, 8 May 2018 09:39:20 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Finn Thain <fthain@...egraphics.com.au>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-m68k <linux-m68k@...ts.linux-m68k.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nubus: Unconditionally register bus type

Hi Finn,

On Sun, May 6, 2018 at 3:47 AM, Finn Thain <fthain@...egraphics.com.au> wrote:
> Loading a NuBus driver module on a non-NuBus machine triggers the
> BUG_ON(!drv->bus->p) in driver_register() because the bus does not get
> registered unless MACH_IS_MAC(). Avoid this by registering the bus
> unconditionally using postcore_initcall().
>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Reported-by: Michael Schmitz <schmitzmic@...il.com>
> Tested-by: Stan Johnson <userm57@...oo.com>
> Fixes: 7f86c765a6a2 ("nubus: Add support for the driver model")
> Signed-off-by: Finn Thain <fthain@...egraphics.com.au>
> ---
>  drivers/nubus/bus.c   | 3 ++-
>  drivers/nubus/nubus.c | 5 -----
>  include/linux/nubus.h | 1 -
>  3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index d306c348c857..27ca9f1a281b 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -63,7 +63,7 @@ static struct device nubus_parent = {
>         .init_name      = "nubus",
>  };
>
> -int __init nubus_bus_register(void)
> +static int __init nubus_bus_register(void)
>  {
>         int err;
>
> @@ -78,6 +78,7 @@ int __init nubus_bus_register(void)
>         device_unregister(&nubus_parent);
>         return err;
>  }
> +postcore_initcall(nubus_bus_register);

nubus_bus_register() two things:

  1. Register the NuBus parent device, which represents the bus host,
  2. Register the NuBus bus, which represents the bus type.

I think this should be split in two, and only the latter should be done
regardless of the presence of NuBus host hardware, to fix the crash.

>
>  static void nubus_device_release(struct device *dev)
>  {
> diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
> index 4621ff98138c..f6bab483f4cb 100644
> --- a/drivers/nubus/nubus.c
> +++ b/drivers/nubus/nubus.c
> @@ -869,15 +869,10 @@ static void __init nubus_scan_bus(void)
>
>  static int __init nubus_init(void)
>  {
> -       int err;
> -
>         if (!MACH_IS_MAC)
>                 return 0;
>
>         nubus_proc_init();
> -       err = nubus_bus_register();
> -       if (err)
> -               return err;

Hence you should still register the NuBus parent device here.

>         nubus_scan_bus();
>         return 0;
>  }


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