* kernel BUG at drivers/net/phy/mdio_bus.c:165!
@ 2008-12-17 2:29 Krzysztof Halasa
2008-12-17 8:24 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Halasa @ 2008-12-17 2:29 UTC (permalink / raw)
To: Lennert Buytenhek; +Cc: David Miller, netdev
kernel BUG at drivers/net/phy/mdio_bus.c:165!
Unable to handle kernel NULL pointer dereference at virtual address 00000000
How?
mdiobus_alloc() sets bus->state = MDIOBUS_ALLOCATED.
mdiobus_register() sets bus->state = MDIOBUS_REGISTERED but then can
fail (mdiobus_scan()) returning an error to the caller.
The caller aborts correctly with mdiobus_free() which does:
if (bus->state == MDIOBUS_ALLOCATED) {
kfree(bus);
return;
}
BUG_ON(bus->state != MDIOBUS_UNREGISTERED);
Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -105,8 +105,6 @@ int mdiobus_register(struct mii_bus *bus)
return -EINVAL;
}
- bus->state = MDIOBUS_REGISTERED;
-
mutex_init(&bus->mdio_lock);
if (bus->reset)
@@ -123,6 +121,9 @@ int mdiobus_register(struct mii_bus *bus)
}
}
+ if (!err)
+ bus->state = MDIOBUS_REGISTERED;
+
pr_info("%s: probed\n", bus->name);
return err;
--
Krzysztof Halasa
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: kernel BUG at drivers/net/phy/mdio_bus.c:165!
2008-12-17 2:29 kernel BUG at drivers/net/phy/mdio_bus.c:165! Krzysztof Halasa
@ 2008-12-17 8:24 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-12-17 8:24 UTC (permalink / raw)
To: khc; +Cc: buytenh, netdev
From: Krzysztof Halasa <khc@pm.waw.pl>
Date: Wed, 17 Dec 2008 03:29:46 +0100
> kernel BUG at drivers/net/phy/mdio_bus.c:165!
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
>
> How?
>
> mdiobus_alloc() sets bus->state = MDIOBUS_ALLOCATED.
>
> mdiobus_register() sets bus->state = MDIOBUS_REGISTERED but then can
> fail (mdiobus_scan()) returning an error to the caller.
>
> The caller aborts correctly with mdiobus_free() which does:
> if (bus->state == MDIOBUS_ALLOCATED) {
> kfree(bus);
> return;
> }
>
> BUG_ON(bus->state != MDIOBUS_UNREGISTERED);
>
> Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>
Looks great, applied.
Thanks for fixing this bug Krzysztof.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-17 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-17 2:29 kernel BUG at drivers/net/phy/mdio_bus.c:165! Krzysztof Halasa
2008-12-17 8:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.