Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256157 > unrolled thread

[PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

Started by"Felipe F. Tonello" <eu@felipetonello.com>
First post2015-10-26 18:00 +0100
Last post2015-10-27 00:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests "Felipe F. Tonello" <eu@felipetonello.com> - 2015-10-26 18:00 +0100
    Re: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue  out requests Robert Baldyga <r.baldyga@hackerion.com> - 2015-10-26 23:30 +0100
      Re: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue  out requests Felipe Tonello <eu@felipetonello.com> - 2015-10-27 00:00 +0100

#1256157 — [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

From"Felipe F. Tonello" <eu@felipetonello.com>
Date2015-10-26 18:00 +0100
Subject[PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests
Message-ID<qnThM-2d0-1@gated-at.bofh.it>
This patch fixes a memory leak that occurs when an endpoint fails to enqueue
the request. If that happens the complete function will never be called, thus
never freeing the request.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
---
 drivers/usb/gadget/function/f_midi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 4c01c8a..0e9cdeb 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -344,6 +344,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 		if (err) {
 			ERROR(midi, "%s queue req: %d\n",
 				    midi->out_ep->name, err);
+			free_ep_req(midi->out_ep, req);
 		}
 	}
 
-- 
2.1.4

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

[toc] | [next] | [standalone]


#1256326 — Re: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

FromRobert Baldyga <r.baldyga@hackerion.com>
Date2015-10-26 23:30 +0100
SubjectRe: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests
Message-ID<qnYr8-5uS-13@gated-at.bofh.it>
In reply to#1256157
On 10/26/2015 05:55 PM, Felipe F. Tonello wrote:
> This patch fixes a memory leak that occurs when an endpoint fails to enqueue
> the request. If that happens the complete function will never be called, thus
> never freeing the request.
> 
> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
> ---
>  drivers/usb/gadget/function/f_midi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
> index 4c01c8a..0e9cdeb 100644
> --- a/drivers/usb/gadget/function/f_midi.c
> +++ b/drivers/usb/gadget/function/f_midi.c
> @@ -344,6 +344,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>  		if (err) {
>  			ERROR(midi, "%s queue req: %d\n",
>  				    midi->out_ep->name, err);
> +			free_ep_req(midi->out_ep, req);
>  		}
>  	}
>  
> 

Don't we have similar problem in f_midi_transmit() and f_midi_complete()
functions?

Best regards,
Robert

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

[toc] | [prev] | [next] | [standalone]


#1256334 — Re: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests

FromFelipe Tonello <eu@felipetonello.com>
Date2015-10-27 00:00 +0100
SubjectRe: [PATCH v4 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests
Message-ID<qnYUa-5Ev-3@gated-at.bofh.it>
In reply to#1256326
Hi Robert,

On Mon, Oct 26, 2015 at 10:23 PM, Robert Baldyga
<r.baldyga@hackerion.com> wrote:
> On 10/26/2015 05:55 PM, Felipe F. Tonello wrote:
>> This patch fixes a memory leak that occurs when an endpoint fails to enqueue
>> the request. If that happens the complete function will never be called, thus
>> never freeing the request.
>>
>> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
>> ---
>>  drivers/usb/gadget/function/f_midi.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
>> index 4c01c8a..0e9cdeb 100644
>> --- a/drivers/usb/gadget/function/f_midi.c
>> +++ b/drivers/usb/gadget/function/f_midi.c
>> @@ -344,6 +344,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>>               if (err) {
>>                       ERROR(midi, "%s queue req: %d\n",
>>                                   midi->out_ep->name, err);
>> +                     free_ep_req(midi->out_ep, req);
>>               }
>>       }
>>
>>
>
> Don't we have similar problem in f_midi_transmit() and f_midi_complete()
> functions?

Yes and it is been addressed on Patch 7.

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web