Re: [PATCH] [media] OMAP1: fix use after free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 30 Jan 2011, Mathias Krause wrote:

> 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.

Hm, ok, I guess, it is a noop on OMAP1, otherwise they'd notice this much 
earlier, so, it, probably, doesn't currently affect the functionality, 
still, I think, this should go in 2.6.38. Don't think we need it in stable 
though. I'll queue it for one of -rcX.

Thanks
Guennadi

> 
> 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@xxxxxxxxxxxxxx>
> ---
>  drivers/media/video/omap1_camera.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c
> index 0a2fb2b..9ed1513 100644
> --- a/drivers/media/video/omap1_camera.c
> +++ b/drivers/media/video/omap1_camera.c
> @@ -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;
> -- 
> 1.5.6.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux