From: David Cohen <david.a.cohen@linux.intel.com>
To: balbi@ti.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: dwc3: gadget: avoid memory leak when failing to allocate all eps
Date: Wed, 11 Sep 2013 17:46:50 -0700 [thread overview]
Message-ID: <52310EFA.6060509@linux.intel.com> (raw)
In-Reply-To: <1378946310-28421-1-git-send-email-david.a.cohen@linux.intel.com>
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@linux.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
prev parent reply other threads:[~2013-09-12 0:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 0:38 [PATCH] usb: dwc3: gadget: avoid memory leak when failing to allocate all eps David Cohen
2013-09-12 0:46 ` David Cohen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52310EFA.6060509@linux.intel.com \
--to=david.a.cohen@linux.intel.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.