net/macb: fix misplaced call of free_netdev() in macb_remove()
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Mon, 15 Dec 2014 14:13:31 +0000 (15:13 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Dec 2014 16:50:45 +0000 (11:50 -0500)
fix a bug introduced by the multiqueue support patch:
"net/macb: add TX multiqueue support for gem"

the "bp" pointer to the netdev private data was dereferenced and used after the
associated memory had been freed by calling free_netdev().

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cadence/macb.c

index 06dea3dd463c2c27936bd5c02cb5a3c76d7bd229..84029ed96d6f658023bda5cfdba3dcc6c390b7bf 100644 (file)
@@ -2408,11 +2408,11 @@ static int __exit macb_remove(struct platform_device *pdev)
                queue = bp->queues;
                for (q = 0; q < bp->num_queues; ++q, ++queue)
                        devm_free_irq(&pdev->dev, queue->irq, queue);
-               free_netdev(dev);
                if (!IS_ERR(bp->tx_clk))
                        clk_disable_unprepare(bp->tx_clk);
                clk_disable_unprepare(bp->hclk);
                clk_disable_unprepare(bp->pclk);
+               free_netdev(dev);
        }
 
        return 0;