Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -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;