[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 коммит произвёл Mauro Carvalho Chehab
Родитель 48a3c77338
Коммит 5bccd60852
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

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