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


Groups > linux.kernel > #1266674

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

From "Felipe F. Tonello" <eu@felipetonello.com>
Newsgroups linux.kernel
Subject [PATCH v5 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests
Date 2015-11-10 19:00 +0100
Message-ID <qtln4-8aF-15@gated-at.bofh.it> (permalink)
References <qtln3-8aF-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 f36db2d..76ea53c 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -345,6 +345,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.5.0

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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v5 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests "Felipe F. Tonello" <eu@felipetonello.com> - 2015-11-10 19:00 +0100
  Re: [PATCH v5 4/7] usb: gadget: f_midi: fix leak on failed to enqueue  out requests Robert Baldyga <r.baldyga@samsung.com> - 2015-11-13 09:40 +0100

csiph-web