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]
Date:	Wed, 11 Sep 2013 17:46:50 -0700
From:	David Cohen <david.a.cohen@...ux.intel.com>
To:	balbi@...com
CC:	gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: dwc3: gadget: avoid memory leak when failing to
 allocate all eps

Hi Mr. Balbi, :)

On 09/11/2013 05:38 PM, David Cohen wrote:
> If dwc3_gadget_init_endpoint() fails after allocate some of the eps, we
> need to free their memory to avoid leak.
>
> Signed-off-by: David Cohen <david.a.cohen@...ux.intel.com>
> ---
>   drivers/usb/dwc3/gadget.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f168eae..611bdba 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1707,8 +1707,13 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
>   
>   	for (epnum = 0; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
>   		dep = dwc->eps[epnum];
> +		/*
> +		 * Because dwc was allocated by kzalloc() and eps are set
> +		 * in ascending order, we can assume no extra one was
> +		 * allocated after first dep == NULL.
> +		 */

Wrong assumption here. Please consider patch v2 instead.

BR, David Cohen

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