Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dnet: fix wrong use of platform_set_drvdata()

platform_set_drvdata() was used with argument of incorrect type and
could cause memory corruption. Moreover, because of not setting drvdata
in the correct place not all resources were freed upon module unload.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ilya Yanok and committed by
David S. Miller
b093dd96 91523947

+1 -2
+1 -2
drivers/net/dnet.c
··· 337 337 for (i = 0; i < PHY_MAX_ADDR; i++) 338 338 bp->mii_bus->irq[i] = PHY_POLL; 339 339 340 - platform_set_drvdata(bp->dev, bp->mii_bus); 341 - 342 340 if (mdiobus_register(bp->mii_bus)) { 343 341 err = -ENXIO; 344 342 goto err_out_free_mdio_irq; ··· 861 863 bp = netdev_priv(dev); 862 864 bp->dev = dev; 863 865 866 + platform_set_drvdata(pdev, dev); 864 867 SET_NETDEV_DEV(dev, &pdev->dev); 865 868 866 869 spin_lock_init(&bp->lock);