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: <20210515101522.GM12395@shell.armlinux.org.uk>
Date:   Sat, 15 May 2021 11:15:22 +0100
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] net: mdiobus: get rid of a BUG_ON()

On Sat, May 15, 2021 at 01:01:11PM +0300, Dan Carpenter wrote:
> We spotted a bug recently during a review where a driver was
> unregistering a bus that wasn't registered, which would trigger this
> BUG_ON().  Let's handle that situation more gracefully, and just print
> a warning and return.
> 
> Reported-by: Russell King <linux@...linux.org.uk>

This probably ought to be updated to:

Reported-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>

now please.

> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>

> ---
>  drivers/net/phy/mdio_bus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index dadf75ff3ab9..6045ad3def12 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus)
>  	struct mdio_device *mdiodev;
>  	int i;
>  
> -	BUG_ON(bus->state != MDIOBUS_REGISTERED);
> +	if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED))
> +		return;
>  	bus->state = MDIOBUS_UNREGISTERED;
>  
>  	for (i = 0; i < PHY_MAX_ADDR; i++) {
> -- 
> 2.30.2
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ