Skip to contentSkip to conversation

USB-CDC: wrong ep status used

PATCH New Stefano Babic 3 participants 6 messages Aug 11, 2010 – Aug 13, 2010 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

In case a status ep is requested, it is always allocated a request for the ep0, instead of the correct one saved in the dev structure.

---
 drivers/usb/gadget/ether.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/ether.c +3 -3
index 9f9b093..1481d76 100644
@@ -1731,14 +1731,14 @@ autoconf_fail:
 	/* ... and maybe likewise for status transfer */
 #if defined(DEV_CONFIG_CDC)
 	if (dev->status_ep) {
-		dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
-		dev->stat_req->buf = status_req;
+		dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
 		if (!dev->stat_req) {
 			dev->stat_req->buf=NULL;
-			usb_ep_free_request (gadget->ep0, dev->req);
+			usb_ep_free_request (dev->status_ep, dev->req);
 
 			goto fail;
 		}
+		dev->stat_req->buf = status_req;
 		dev->stat_req->context = NULL;
 	}
 #endif
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

Hi Stefano,

drivers/usb/gadget/ether.c autoconf_fail: · line 1736

Quoted 7 lines · Stefano Babic

#if defined(DEV_CONFIG_CDC)

drivers/usb/gadget/ether.c +1 -2
 	if (dev->status_ep) {
-		dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
-		dev->stat_req->buf = status_req;
+		dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
 		if (!dev->stat_req) {
 			dev->stat_req->buf=NULL;

We get oops here!

Quoted 9 lines
drivers/usb/gadget/ether.c +2 -1
-			usb_ep_free_request (gadget->ep0, dev->req);
+			usb_ep_free_request (dev->status_ep, dev->req);
 
 			goto fail;
 		}
+		dev->stat_req->buf = status_req;
 		dev->stat_req->context = NULL;
 	}
 #endif
#2 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

Quoted 11 lines · Vitaly Kuzmichev

Hi Stefano,

drivers/usb/gadget/ether.c autoconf_fail: · line 1736

Quoted 7 lines · Stefano Babic

#if defined(DEV_CONFIG_CDC)

drivers/usb/gadget/ether.c +1 -2
 	if (dev->status_ep) {
-		dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
-		dev->stat_req->buf = status_req;
+		dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
 		if (!dev->stat_req) {
 			dev->stat_req->buf=NULL;

We get oops here!

Agree, and the issue is not related to this patch, I missed to correct it, thanks. If no one complains, I will send a single patch to fix both problems (wrong ep status + null pointer access).

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#3 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

Hello.

Quoted 10 lines · Stefano Babic
Quoted 9 lines · Stefano Babic

drivers/usb/gadget/ether.c autoconf_fail: · line 1736

Quoted 7 lines

#if defined(DEV_CONFIG_CDC)

drivers/usb/gadget/ether.c +1 -2
 	if (dev->status_ep) {
-		dev->stat_req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL);
-		dev->stat_req->buf = status_req;
+		dev->stat_req = usb_ep_alloc_request(dev->status_ep, GFP_KERNEL);
 		if (!dev->stat_req) {
 			dev->stat_req->buf=NULL;

We get oops here!

Quoted 3 lines

Agree, and the issue is not related to this patch, I missed to correct it, thanks. If no one complains, I will send a single patch to fix both problems (wrong ep status + null pointer access).

Looks like Vitaly has done the same already:

http://lists.denx.de/pipermail/u-boot/2010-August/075419.html

Quoted 2 lines

Best regards,
Stefano

WBR, Sergei

#4 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

Hi Sergei,

Quoted 4 lines · Sergei Shtylyov

Hello.

Stefano Babic wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

We get oops here!

Agree, and the issue is not related to this patch, I missed to correct it, thanks. If no one complains, I will send a single patch to fix both problems (wrong ep status + null pointer access).

Looks like Vitaly has done the same already:

Yes, but I have not seen Stefano's comment when sent.

Stefano,
I would like to add you 'signed-off' in this patch because I took this part from your patch:
- usb_ep_free_request (gadget->ep0, dev->req);
+ usb_ep_free_request (dev->status_ep, dev->req);

Do you allow me to add your signature?

#5 lore raw

PATCH 1/1 USB-CDC: wrong ep status used

Quoted 21 lines · Vitaly Kuzmichev

Hi Sergei,

Quoted 10 lines · Sergei Shtylyov

Hello.

Quoted 4 lines · Stefano Babic
Quoted 1 line

We get oops here!

Agree, and the issue is not related to this patch, I missed to correct it, thanks. If no one complains, I will send a single patch to fix both problems (wrong ep status + null pointer access).

Looks like Vitaly has done the same already:

Yes, but I have not seen Stefano's comment when sent.

Stefano,
I would like to add you 'signed-off' in this patch because I took this part from your patch:

drivers/usb/gadget/ether.c +1 -1
-			usb_ep_free_request (gadget->ep0, dev->req);
+			usb_ep_free_request (dev->status_ep, dev->req);
Quoted 2 lines

Do you allow me to add your signature?

Yes, of course !

Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================