From: Stefan Weil Date: Tue, 3 Aug 2010 08:53:45 +0000 (+0000) Subject: davinci_emac: Fix use after free in davinci_emac_remove X-Git-Tag: MMI-PSA29.97-13-9~22097^2~244 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a1bc0d56b446104a3a728925b3a7afbef64afa7;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git davinci_emac: Fix use after free in davinci_emac_remove 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 Cc: Chaithrika U S Cc: Sriramakrishnan Cc: Kevin Hilman Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Stefan Weil Signed-off-by: David S. Miller --- diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index d0824e322068..7fbd052ddb0a 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -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);