From patchwork Mon Sep 28 15:49:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 54206 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 674A622B1E for ; Mon, 28 Sep 2015 15:49:22 +0000 (UTC) Received: by labjk1 with SMTP id jk1sf2003877lab.0 for ; Mon, 28 Sep 2015 08:49:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:content-type:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=FhRioGZpfPDujFTRTEqUpqf5BiYS9n+Uj3u6A1U1VX8=; b=hj6x7FH0dJzNa1sldfIDh1GFbJ55IDmQCDG2yQdp7oqN5HMJ8HtKkZqQ1JJYzd1S28 SGLZUYkHaHwjH3Z+htsvlXpOqBzpJ169AVR1tSoA3MTWwxxaeB5Fi5zerPkgIs2htcow ZehQ2a4LdCQ1Y2NZachO0VfN2SDxWuxUV00cBvm//m/w2zx01DaT3YJ7V2bS6Q6pg7Aa d9UloAeM30V3z8KsEsr2VENDv12XlB3Uc2ovmaOJHGc2rX0cZKwxxndIr4pODk9RRcy3 hEcbHwO7UYfZHTwaihT1iLFjEpA1779/r72xzSVM25RfFo3gik1l/cw7rOvVr4TI4kF4 WvJg== X-Gm-Message-State: ALoCoQk/24JcaXNwzNEdk+ZNCbUyIQNMWe5uDps+U//G0T9yTQqGG6I9H9xCy6Hooa29bq6Ms3ap X-Received: by 10.25.22.94 with SMTP id m91mr82415lfi.3.1443455360610; Mon, 28 Sep 2015 08:49:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.36 with SMTP id i4ls53919lag.71.gmail; Mon, 28 Sep 2015 08:49:20 -0700 (PDT) X-Received: by 10.25.31.212 with SMTP id f203mr3808507lff.6.1443455360473; Mon, 28 Sep 2015 08:49:20 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id y7si6435173laa.88.2015.09.28.08.49.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2015 08:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laclj5 with SMTP id lj5so71291564lac.3 for ; Mon, 28 Sep 2015 08:49:20 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr5508630lbb.112.1443455359975; Mon, 28 Sep 2015 08:49:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1627833lbq; Mon, 28 Sep 2015 08:49:19 -0700 (PDT) X-Received: by 10.202.174.206 with SMTP id x197mr10740000oie.50.1443455359001; Mon, 28 Sep 2015 08:49:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r189si8535962oig.74.2015.09.28.08.49.18; Mon, 28 Sep 2015 08:49:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934173AbbI1PtR (ORCPT + 4 others); Mon, 28 Sep 2015 11:49:17 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:38034 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934034AbbI1PtR (ORCPT ); Mon, 28 Sep 2015 11:49:17 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8SFnCps018767; Mon, 28 Sep 2015 10:49:12 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8SFnCIg031345; Mon, 28 Sep 2015 10:49:12 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Mon, 28 Sep 2015 10:49:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8SFnBe9021161; Mon, 28 Sep 2015 10:49:11 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: , Felipe Balbi Subject: [PATCH] usb: gadget: pch-udc: fix lock Date: Mon, 28 Sep 2015 10:49:10 -0500 Message-ID: <1443455350-3905-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0.GIT MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , gadget methods should be called without spinlocks held. Reported-by: Alexey Khoroshilov Signed-off-by: Felipe Balbi --- drivers/usb/gadget/udc/pch_udc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index e5f4c5274298..3181fc9c1c49 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -2747,18 +2747,18 @@ static void pch_udc_dev_isr(struct pch_udc_dev *dev, u32 dev_intr) if (dev_intr & UDC_DEVINT_US) { if (dev->driver && dev->driver->suspend) { - spin_lock(&dev->lock); - dev->driver->suspend(&dev->gadget); spin_unlock(&dev->lock); + dev->driver->suspend(&dev->gadget); + spin_lock(&dev->lock); } vbus = pch_vbus_gpio_get_value(dev); if ((dev->vbus_session == 0) && (vbus != 1)) { if (dev->driver && dev->driver->disconnect) { - spin_lock(&dev->lock); - dev->driver->disconnect(&dev->gadget); spin_unlock(&dev->lock); + dev->driver->disconnect(&dev->gadget); + spin_lock(&dev->lock); } pch_udc_reconnect(dev); } else if ((dev->vbus_session == 0)