[PATCH v3] usbcore: check usb device's state before sending a Set SEL control transfer

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

 



Set SEL control urbs cannot be sent to a device in unconfigured state.
This patch adds a check in usb_req_set_sel() to ensure the usb device's
state is USB_STATE_CONFIGURED.

Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
Reported-by: Martin MOKREJS <mmokrejs@xxxxxxxxx>
Suggested-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
---

Differences from v2:

-push the check on device's state down to usb_req_set_sel()
-check only that the device is in configured state
-update commit title and changelog

 drivers/usb/core/hub.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index fe8d95d..cc468f8 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3424,6 +3424,9 @@ static int usb_req_set_sel(struct usb_device *udev, enum usb3_link_state state)
 	unsigned long long u2_pel;
 	int ret;
 
+	if (udev->state != USB_STATE_CONFIGURED)
+		return 0;
+
 	/* Convert SEL and PEL stored in ns to us */
 	u1_sel = DIV_ROUND_UP(udev->u1_params.sel, 1000);
 	u1_pel = DIV_ROUND_UP(udev->u1_params.pel, 1000);
-- 
1.8.3.4

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