mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
9a3de25544
commit
e8e5752dc0
1 changed files with 3 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue