Skip to content

Commit

Permalink
[media] V4L: omap1_camera: fix use after free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mathias Krause authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent 48a3c77 commit 5bccd60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/video/omap1_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5bccd60

Please sign in to comment.