Commit 5bccd608 authored by Mathias Krause's avatar Mathias Krause Committed by Mauro Carvalho Chehab

[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: default avatarMathias Krause <minipli@googlemail.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 48a3c773
...@@ -1664,10 +1664,10 @@ static int __exit omap1_cam_remove(struct platform_device *pdev) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment