[PATCH] USB: EHCI: Fix isochronous URB leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ehci-hcd uses usb_get_urb() and usb_put_urb() in an unbalanced way causing
isochronous URB's kref.counts incrementing once per usb_submit_urb() call.
There is no need for ehci-hcd to deal with usb_get_urb() nor usb_put_urb()
anyhow, so patch removes their usages in ehci-hcd.
It also removes NULL assignments that have no effect.

Signed-off-by: Karsten Wiese <fzu@xxxxxxxxxxxxxxxxxxxxx>
---

Made against 2.6.29-rc6. Suitable to go there and stable ASAP, no?

Thanks,
Karsten


 drivers/usb/host/ehci-sched.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a081ee6..c147dfa 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1535,7 +1535,7 @@ itd_link_urb (
 					struct ehci_itd, itd_list);
 			list_move_tail (&itd->itd_list, &stream->td_list);
 			itd->stream = iso_stream_get (stream);
-			itd->urb = usb_get_urb (urb);
+			itd->urb = urb;
 			itd_init (ehci, stream, itd);
 		}
 
@@ -1640,7 +1640,6 @@ itd_complete (
 	dev = urb->dev;
 	ehci_urb_done(ehci, urb, 0);
 	retval = true;
-	urb = NULL;
 	(void) disable_periodic(ehci);
 	ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
@@ -1655,9 +1654,6 @@ itd_complete (
 	iso_stream_put (ehci, stream);
 	/* OK to recycle this ITD now that its completion callback ran. */
 done:
-	usb_put_urb(urb);
-	itd->urb = NULL;
-	itd->stream = NULL;
 	list_move(&itd->itd_list, &stream->free_list);
 	iso_stream_put(ehci, stream);
 
@@ -1934,7 +1930,7 @@ sitd_link_urb (
 				struct ehci_sitd, sitd_list);
 		list_move_tail (&sitd->sitd_list, &stream->td_list);
 		sitd->stream = iso_stream_get (stream);
-		sitd->urb = usb_get_urb (urb);
+		sitd->urb = urb;
 
 		sitd_patch(ehci, stream, sitd, sched, packet);
 		sitd_link (ehci, (next_uframe >> 3) % ehci->periodic_size,
@@ -2015,7 +2011,6 @@ sitd_complete (
 	dev = urb->dev;
 	ehci_urb_done(ehci, urb, 0);
 	retval = true;
-	urb = NULL;
 	(void) disable_periodic(ehci);
 	ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
@@ -2030,9 +2025,6 @@ sitd_complete (
 	iso_stream_put (ehci, stream);
 	/* OK to recycle this SITD now that its completion callback ran. */
 done:
-	usb_put_urb(urb);
-	sitd->urb = NULL;
-	sitd->stream = NULL;
 	list_move(&sitd->sitd_list, &stream->free_list);
 	iso_stream_put(ehci, stream);
 
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux