Skip to content

Commit

Permalink
can: flexcan: fix use after free of priv
Browse files Browse the repository at this point in the history
The priv is part of the memory allocated by alloc_candev().
This patch moved the free it after last usage of priv.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Marc Kleine-Budde authored and David S. Miller committed Oct 26, 2010
1 parent 06d6e6d commit 9a27586
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,14 +992,15 @@ static int __devexit flexcan_remove(struct platform_device *pdev)

unregister_flexcandev(dev);
platform_set_drvdata(pdev, NULL);
free_candev(dev);
iounmap(priv->base);

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));

clk_put(priv->clk);

free_candev(dev);

return 0;
}

Expand Down

0 comments on commit 9a27586

Please sign in to comment.