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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Apr 2016 11:26:29 +0300
From:	Felipe Balbi <balbi@...nel.org>
To:	changbin.du@...el.com
Cc:	gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"Du\, Changbin" <changbin.du@...el.com>
Subject: Re: [PATCH v2] usb: dwc3: fix memory leak of dwc->regset


Hi,

changbin.du@...el.com writes:
> From: "Du, Changbin" <changbin.du@...el.com>
>
> dwc->regset is allocated on dwc3_debugfs_init, and should
> be released on init failure or dwc3_debugfs_exit. Btw,
> The line "dwc->root = NULL" is unnecessary, so remove it.
>
> Signed-off-by: Du, Changbin <changbin.du@...el.com>
> ---
> v2:
>   Title changed;
>   free dwc->regset on failure path.
>
> ---
>  drivers/usb/dwc3/debugfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
> index 9ac37fe..abd8889 100644
> --- a/drivers/usb/dwc3/debugfs.c
> +++ b/drivers/usb/dwc3/debugfs.c
> @@ -678,7 +678,8 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
>  
>  err1:
>  	debugfs_remove_recursive(root);
> -
> +	if (!dwc->regset)
> +		kfree(dwc->regset);

IOW:

        if regset is NULL, free NULL.

This check is wrong and unnecessary ;-) kfree(NULL) is safe.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (819 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ