lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <005301cfb50a$1054b140$30fe13c0$%han@samsung.com>
Date:	Mon, 11 Aug 2014 11:15:04 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Himangi Saraogi' <himangi774@...il.com>,
	'Felipe Balbi' <balbi@...com>
Cc:	'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	'Julia Lawall' <julia.lawall@...6.fr>,
	'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH] usb: phy: drop kfree of devm_kzalloc's data

On Monday, August 11, 2014 5:00 AM, Himangi Saraogi wrote:
> 
> Using kfree to free data allocated with devm_kzalloc causes double frees.
> 
> The Coccinelle semantic patch that fixes this problem is as follows:
> 
> // <smpl>
> @@
> expression x;
> @@
> 
> x = devm_kzalloc(...)
> ...
> ?-kfree(x);
> // </smpl>
> 
> Signed-off-by: Himangi Saraogi <himangi774@...il.com>
> Acked-by: Julia Lawall <julia.lawall@...6.fr>

Reviewed-by: Jingoo Han <jg1.han@...sung.com>

Best regards,
Jingoo Han

> ---
>  drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
> index ea9e705..f4b14bd 100644
> --- a/drivers/usb/phy/phy-gpio-vbus-usb.c
> +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
> @@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev)
> 
>  	gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
>  					  GFP_KERNEL);
> -	if (!gpio_vbus->phy.otg) {
> -		kfree(gpio_vbus);
> +	if (!gpio_vbus->phy.otg)
>  		return -ENOMEM;
> -	}
> 
>  	platform_set_drvdata(pdev, gpio_vbus);
>  	gpio_vbus->dev = &pdev->dev;
> --
> 1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ