lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Oct 2016 16:15:41 +0530
From:   Sriram Dash <sriram.dash@....com>
To:     <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>
CC:     <mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
        <suresh.gupta@....com>, <felipe.balbi@...ux.intel.com>,
        <stern@...land.harvard.edu>, Sriram Dash <sriram.dash@....com>,
        Rajat Srivastava <rajat.srivastava@....com>,
        Rajesh Bhagat <rajesh.bhagat@....com>
Subject: [PATCH v2] usb: xhci: Don't drive port 2.0 reset while resuming

For the USB3.0 controller, USB 2.0 reset not driven while
port is in Resume state. So, do not program the USB 2.0 reset
(PORTSC[PR]=1) while in Resume state.

Signed-off-by: Rajat Srivastava <rajat.srivastava@....com>
Signed-off-by: Sriram Dash <sriram.dash@....com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@....com>
---
Changes in v2:
  - Remove the quirk and make it generic to xhci.
  - Edit the title and comment


 drivers/usb/host/xhci-hub.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 730b9fd..a27dbb4 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -878,7 +878,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 	int max_ports;
 	unsigned long flags;
-	u32 temp, status;
+	u32 temp, status, tmp_status = 0;
 	int retval = 0;
 	__le32 __iomem **port_array;
 	int slot_id;
@@ -1098,6 +1098,21 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			spin_lock_irqsave(&xhci->lock, flags);
 			break;
 		case USB_PORT_FEAT_RESET:
+			/*
+			 * Do not drive a reset signal when the port
+			 * is resuming
+			 */
+			tmp_status = readl(port_array[wIndex]);
+			spin_unlock_irqrestore(&xhci->lock, flags);
+			if (!DEV_SUPERSPEED(tmp_status)	&&
+			    (tmp_status & PORT_PLS_MASK) == XDEV_RESUME) {
+				xhci_err(xhci, "skip port reset\n");
+				spin_lock_irqsave(&xhci->lock, flags);
+				retval = -EPERM;
+				break;
+			}
+			spin_lock_irqsave(&xhci->lock, flags);
+
 			temp = (temp | PORT_RESET);
 			writel(temp, port_array[wIndex]);
 
-- 
2.1.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ