diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2008-12-17 03:24:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-17 03:24:13 -0500 |
commit | e8e5752dc0a56a01527055b0c37510b1d6b6b861 (patch) | |
tree | 65066b89fe67651445f25d586db615c3fbbcf81c /drivers | |
parent | 9a3de25544dadab1971847f28f33b1cd0d1770a6 (diff) |
net: kernel BUG at drivers/net/phy/mdio_bus.c:165!
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 536bda1f428b..289fc267edf3 100644 --- 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) | |||
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | } | 106 | } |
107 | 107 | ||
108 | bus->state = MDIOBUS_REGISTERED; | ||
109 | |||
110 | mutex_init(&bus->mdio_lock); | 108 | mutex_init(&bus->mdio_lock); |
111 | 109 | ||
112 | if (bus->reset) | 110 | if (bus->reset) |
@@ -123,6 +121,9 @@ int mdiobus_register(struct mii_bus *bus) | |||
123 | } | 121 | } |
124 | } | 122 | } |
125 | 123 | ||
124 | if (!err) | ||
125 | bus->state = MDIOBUS_REGISTERED; | ||
126 | |||
126 | pr_info("%s: probed\n", bus->name); | 127 | pr_info("%s: probed\n", bus->name); |
127 | 128 | ||
128 | return err; | 129 | return err; |