Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1209179

[PATCH 1/5] usb: xhci: lock mutex on xhci_stop

Path csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!nntpspool01.opticnetworks.net!aioe.org!bofh.it!news.nic.it!robomod
From Roger Quadros <rogerq@ti.com>
Newsgroups linux.kernel
Subject [PATCH 1/5] usb: xhci: lock mutex on xhci_stop
Date Tue, 18 Aug 2015 12:50:02 +0200
Message-ID <pYMCS-3Kd-17@gated-at.bofh.it> (permalink)
References <pYMtc-3yQ-9@gated-at.bofh.it>
X-Original-To <mathias.nyman@intel.com>
X-Mailer git-send-email 2.1.4
MIME-Version 1.0
Content-Type text/plain
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 39
Organization linux.* mail to news gateway
X-Original-Cc <balbi@ti.com>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
X-Original-Date Tue, 18 Aug 2015 13:39:10 +0300
X-Original-Message-ID <1439894354-6160-2-git-send-email-rogerq@ti.com>
X-Original-References <1439894354-6160-1-git-send-email-rogerq@ti.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1209179

Show key headers only | View raw


Else it races with xhci_setup_device

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 526ebc0..f998ddf 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -677,8 +677,11 @@ void xhci_stop(struct usb_hcd *hcd)
 	u32 temp;
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
+	mutex_lock(&xhci->mutex);
+
 	if (!usb_hcd_is_primary_hcd(hcd)) {
 		xhci_only_stop_hcd(xhci->shared_hcd);
+		mutex_unlock(&xhci->mutex);
 		return;
 	}
 
@@ -717,6 +720,7 @@ void xhci_stop(struct usb_hcd *hcd)
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 			"xhci_stop completed - status = %x",
 			readl(&xhci->op_regs->status));
+	mutex_unlock(&xhci->mutex);
 }
 
 /*
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] usb: xhci: lock mutex on xhci_stop Roger Quadros <rogerq@ti.com> - 2015-08-18 12:50 +0200
  Re: [PATCH 1/5] usb: xhci: lock mutex on xhci_stop Mathias Nyman <mathias.nyman@intel.com> - 2015-08-18 13:40 +0200

csiph-web