Skip to content

Commit 04aa1bc

Browse files
Bruno Carneiro da Cunhadavem330
authored andcommitted
lpc_eth: kernel BUG on remove
We may have found a bug in the nxp/lpc_eth.c driver. The function platform_set_drvdata() is called twice, the second time it is called, in lpc_mii_init(), it overwrites the struct net_device which should be at pdev->dev->driver_data with pldat->mii_bus. When trying to remove the driver, in lpc_eth_drv_remove(), platform_get_drvdata() will return the pldat->mii_bus pointer and try to use it as a struct net_device pointer. This causes unregister_netdev to segfault and generate a kernel BUG. Is this reproducible? Signed-off-by: Daniel Martinez <[email protected]> Signed-off-by: Bruno Carneiro da Cunha <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9424e2e commit 04aa1bc

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/net/ethernet/nxp/lpc_eth.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,6 @@ static int lpc_mii_init(struct netdata_local *pldat)
817817
pldat->mii_bus->priv = pldat;
818818
pldat->mii_bus->parent = &pldat->pdev->dev;
819819

820-
platform_set_drvdata(pldat->pdev, pldat->mii_bus);
821-
822820
node = of_get_child_by_name(pldat->pdev->dev.of_node, "mdio");
823821
err = of_mdiobus_register(pldat->mii_bus, node);
824822
of_node_put(node);

0 commit comments

Comments
 (0)