[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>
This commit is contained in:
Mathias Krause 2011-01-30 07:05:58 -03:00 committed by Mauro Carvalho Chehab
parent 48a3c77338
commit 5bccd60852
1 changed files with 2 additions and 2 deletions

View File

@ -1664,10 +1664,10 @@ static int __exit omap1_cam_remove(struct platform_device *pdev)
res = pcdev->res;
release_mem_region(res->start, resource_size(res));
kfree(pcdev);
clk_put(pcdev->clk);
kfree(pcdev);
dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
return 0;