Skip to content

Commit

Permalink
davinci_emac: Fix use after free in davinci_emac_remove
Browse files Browse the repository at this point in the history
free_netdev finally calls kfree which makes the contents
of ndev and priv (private data contained in ndev) invalid.

So iounmap should be called before free_netdev.

Cc: David S. Miller <davem@davemloft.net>
Cc: Chaithrika U S <chaithrika@ti.com>
Cc: Sriramakrishnan <srk@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stefan Weil authored and David S. Miller committed Aug 4, 2010
1 parent 889635f commit 2a1bc0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/davinci_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2944,8 +2944,8 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
release_mem_region(res->start, res->end - res->start + 1);

unregister_netdev(ndev);
free_netdev(ndev);
iounmap(priv->remap_addr);
free_netdev(ndev);

clk_disable(emac_clk);
clk_put(emac_clk);
Expand Down

0 comments on commit 2a1bc0d

Please sign in to comment.