[RFC] Warn about resets of active endpoints

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

 



On Tue, 10 Mar 2015, Alan Stern wrote:

> However, if a driver tries to issue an endpoint reset while there are
> still some URBs queued, it is a bug.  Host controller drivers shouldn't
> have to worry about this -- xhci_endpoint_reset() should simply return 
> an error if the endpoint ring isn't empty.
> 
> I suppose we should check for this in the USB core.  I'll write a patch
> and CC: you.

Here it is.  Does this mean your new patch isn't needed?

Jörg, what do you get if you test with this patch applied?

Alan Stern



Index: usb-3.19/drivers/usb/core/hcd.c
===================================================================
--- usb-3.19.orig/drivers/usb/core/hcd.c
+++ usb-3.19/drivers/usb/core/hcd.c
@@ -2018,6 +2018,14 @@ void usb_hcd_reset_endpoint(struct usb_d
 {
 	struct usb_hcd *hcd = bus_to_hcd(udev->bus);
 
+	/* Resetting an active endpoint is a bug! */
+	if (!list_empty(&ep->urb_list)) {
+		WARN(1, "%s ep %02x: attempt to reset active endpoint\n",
+				dev_name(&udev->dev),
+				ep->desc.bEndpointAddress);
+		return;
+	}
+
 	if (hcd->driver->endpoint_reset)
 		hcd->driver->endpoint_reset(hcd, ep);
 	else {

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