aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2011-01-30 05:05:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:32:14 -0400
commit5bccd60852fc0a5ccc1980c10266896df99b8bda (patch)
treeeefbf7feda0db2d2d23c9b8d22b739adedc8c5a0
parent48a3c77338d725d4976fa792d822eb940ce5c296 (diff)
[media] V4L: omap1_camera: fix use after free
Even though clk_put() is a no-op on most architectures it is not for some ARM implementations. To not fail on those, release the clock timer before freeing the surrounding structure. This bug was spotted by the semantic patch tool coccinelle using the script found at scripts/coccinelle/free/kfree.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/omap1_camera.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c
index 0a2fb2bfdbfb..9ed1513122c1 100644
--- a/drivers/media/video/omap1_camera.c
+++ b/drivers/media/video/omap1_camera.c
@@ -1664,10 +1664,10 @@ static int __exit omap1_cam_remove(struct platform_device *pdev)
1664 res = pcdev->res; 1664 res = pcdev->res;
1665 release_mem_region(res->start, resource_size(res)); 1665 release_mem_region(res->start, resource_size(res));
1666 1666
1667 kfree(pcdev);
1668
1669 clk_put(pcdev->clk); 1667 clk_put(pcdev->clk);
1670 1668
1669 kfree(pcdev);
1670
1671 dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n"); 1671 dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
1672 1672
1673 return 0; 1673 return 0;