public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] gadget: f_thor: fix hang-up with ctrl-c
       [not found] <CGME20180604065410epcas1p43c4bf88f56b8de9e8d5f55bcd4274518@epcas1p4.samsung.com>
@ 2018-06-04  6:53 ` Seung-Woo Kim
  2018-06-12 11:21   ` Lukasz Majewski
  0 siblings, 1 reply; 2+ messages in thread
From: Seung-Woo Kim @ 2018-06-04  6:53 UTC (permalink / raw)
  To: u-boot

After the commit 6aae84769a0b ("gadget: f_thor: Fix memory leaks of
usb request and its buffer"), there is hang-up with ctrl-c in some
udc. It is because req of out_ep is freed before out_ep is disabled.
Fix hang-up with ctrl-c by disabling ep before free req of the ep.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 drivers/usb/gadget/f_thor.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index 1aa6be4..8b3b19f 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -877,14 +877,14 @@ static void thor_func_disable(struct usb_function *f)
 
 	/* Avoid freeing memory when ep is still claimed */
 	if (dev->in_ep->driver_data) {
-		free_ep_req(dev->in_ep, dev->in_req);
 		usb_ep_disable(dev->in_ep);
+		free_ep_req(dev->in_ep, dev->in_req);
 		dev->in_ep->driver_data = NULL;
 	}
 
 	if (dev->out_ep->driver_data) {
-		usb_ep_free_request(dev->out_ep, dev->out_req);
 		usb_ep_disable(dev->out_ep);
+		usb_ep_free_request(dev->out_ep, dev->out_req);
 		dev->out_ep->driver_data = NULL;
 	}
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH 1/3] gadget: f_thor: fix hang-up with ctrl-c
  2018-06-04  6:53 ` [U-Boot] [PATCH 1/3] gadget: f_thor: fix hang-up with ctrl-c Seung-Woo Kim
@ 2018-06-12 11:21   ` Lukasz Majewski
  0 siblings, 0 replies; 2+ messages in thread
From: Lukasz Majewski @ 2018-06-12 11:21 UTC (permalink / raw)
  To: u-boot

Hi Seung-Woo,

> After the commit 6aae84769a0b ("gadget: f_thor: Fix memory leaks of
> usb request and its buffer"), there is hang-up with ctrl-c in some
> udc. It is because req of out_ep is freed before out_ep is disabled.
> Fix hang-up with ctrl-c by disabling ep before free req of the ep.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
>  drivers/usb/gadget/f_thor.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index 1aa6be4..8b3b19f 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -877,14 +877,14 @@ static void thor_func_disable(struct
> usb_function *f) 
>  	/* Avoid freeing memory when ep is still claimed */
>  	if (dev->in_ep->driver_data) {
> -		free_ep_req(dev->in_ep, dev->in_req);
>  		usb_ep_disable(dev->in_ep);
> +		free_ep_req(dev->in_ep, dev->in_req);
>  		dev->in_ep->driver_data = NULL;
>  	}
>  
>  	if (dev->out_ep->driver_data) {
> -		usb_ep_free_request(dev->out_ep, dev->out_req);
>  		usb_ep_disable(dev->out_ep);
> +		usb_ep_free_request(dev->out_ep, dev->out_req);
>  		dev->out_ep->driver_data = NULL;
>  	}
>  

Applied to u-boot-dfu tree.

Thanks for this fix.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180612/ae79ee1b/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-12 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180604065410epcas1p43c4bf88f56b8de9e8d5f55bcd4274518@epcas1p4.samsung.com>
2018-06-04  6:53 ` [U-Boot] [PATCH 1/3] gadget: f_thor: fix hang-up with ctrl-c Seung-Woo Kim
2018-06-12 11:21   ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox