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]
Message-ID: <alpine.LNX.2.21.1805081638020.30@nippy.intranet>
Date:   Tue, 8 May 2018 17:59:52 +1000 (AEST)
From:   Finn Thain <fthain@...egraphics.com.au>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
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

On Tue, 8 May 2018, Geert Uytterhoeven wrote:

> > This example is the sort of flag removal that I had in mind --
> >
> > diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> > index ba912558a510..4ee22fb3db92 100644
> > --- a/drivers/base/driver.c
> > +++ b/drivers/base/driver.c
> > @@ -148,7 +148,8 @@ int driver_register(struct device_driver *drv)
> >         int ret;
> >         struct device_driver *other;
> >
> > -       BUG_ON(!drv->bus->p);
> > +       if (!drv->bus->p)
> > +               return -ENODEV;
> 
> If this is meant to handle the case where the device driver is registered
> before the bus is registered, while the latter can still happen later,
> then you want to return -EPROBE_DEFER.
> 

Returning -EAGAIN might be appropriate if driver_register() could 
reasonably expect the bus to come into existence.

However, a separation of concerns would seem to imply that the driver core 
has no way of knowing whether that might happen.

Anyway, this discussion is academic. The patch was only meant to 
illustrate a way to remove code instead of adding it, while achieving the 
same goal.

I'm not proposing this patch. I don't claim to understand all of the 
considerations that apply here. I'm certain there are situations where 
BUG_ON is appropriate. This may be one of those situations.

-- 

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ