summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-12-22 21:30:59 +0100
committerDan Williams <dan.j.williams@intel.com>2009-12-22 15:30:08 -0700
commit0794ec8ce327ec74416b569b8fb1951274693700 (patch)
tree4e6a59cdf0c13005d22165932b82acf1213bc937
parent1e9d1b13efae7e0a2705611d47ae5f07e27015f0 (diff)
downloadlinux-0794ec8ce327ec74416b569b8fb1951274693700.tar.bz2
drivers/dma: Correct use after free
Move the kfree after the iounmap that refers to the same structure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,e; identifier f; iterator I; statement S; @@ *kfree(x); ... when != &x when != x = e when != I(x,...) S *x->f // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/dma/coh901318.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 4a99cd94536b..b5f2ee0f8e2c 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -1294,8 +1294,8 @@ static int __exit coh901318_remove(struct platform_device *pdev)
dma_async_device_unregister(&base->dma_slave);
coh901318_pool_destroy(&base->pool);
free_irq(platform_get_irq(pdev, 0), base);
- kfree(base);
iounmap(base->virtbase);
+ kfree(base);
release_mem_region(pdev->resource->start,
resource_size(pdev->resource));
return 0;