* [PATCH 1/1] drivers/net/usb/usbnet.c: No need for usb_free_urb in rx_complete
@ 2011-09-03 17:35 Kautuk Consul
2011-09-03 20:02 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Kautuk Consul @ 2011-09-03 17:35 UTC (permalink / raw)
To: Oliver Neukum
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Kautuk Consul
usb_hcd_giveback_urb frees the urb irrespective of any return
value from the urb->complete function. It calls usb_put_urb which
is #defined to usb_free_urb, so maybe we shouldn't be freeing this
from rx_complete.
But I can't get around the fact that this has not been detected as a problem
till now, so I could be quite wrong about this. :)
Signed-off-by: Kautuk Consul <consul.kautuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/usb/usbnet.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ce395fe..6df8094 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -491,7 +491,6 @@ block:
rx_submit (dev, urb, GFP_ATOMIC);
return;
}
- usb_free_urb (urb);
}
netif_dbg(dev, rx_err, dev->net, "no read resubmitted\n");
}
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] drivers/net/usb/usbnet.c: No need for usb_free_urb in rx_complete
2011-09-03 17:35 [PATCH 1/1] drivers/net/usb/usbnet.c: No need for usb_free_urb in rx_complete Kautuk Consul
@ 2011-09-03 20:02 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2011-09-03 20:02 UTC (permalink / raw)
To: Kautuk Consul; +Cc: Oliver Neukum, netdev, linux-usb
On Sat, 3 Sep 2011, Kautuk Consul wrote:
> usb_hcd_giveback_urb frees the urb irrespective of any return
> value from the urb->complete function. It calls usb_put_urb which
> is #defined to usb_free_urb, so maybe we shouldn't be freeing this
> from rx_complete.
usb_free_urb() doesn't free its argument unless the refcount drops to
0. The refcount is incremented during usb_hcd_submit_urb(), and the
decrement during usb_hcd_giveback_urb() merely undoes this increment.
> But I can't get around the fact that this has not been detected as a problem
> till now, so I could be quite wrong about this. :)
Quite probably. :-)
Alan Stern
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-03 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-03 17:35 [PATCH 1/1] drivers/net/usb/usbnet.c: No need for usb_free_urb in rx_complete Kautuk Consul
2011-09-03 20:02 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox