Received: by 10.213.65.68 with SMTP id h4csp1729960imn; Mon, 19 Mar 2018 11:39:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELviTCNzDQcgjVZ6GKPI35X2Ak0MK3AAII5j2J7cE4/5uGxOhH2GBN3sCbiU2rL5aXM2dacl X-Received: by 2002:a17:902:3283:: with SMTP id z3-v6mr13283557plb.118.1521484752802; Mon, 19 Mar 2018 11:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521484752; cv=none; d=google.com; s=arc-20160816; b=xfT+l24zZ0cHFvxiLv3RcLc+1mc7oCGF+gg5tEaUDW+fQxjm6rxaG4kPRwHyCyA5XT CSrgsfL66VEY1jhrhLVDcQJ02shO1iU4wiIlTmHSqWUXfePMjhrnrPXM7II1GMJDSTGG kGzieA6fwm3R8N3OeYG02yi61+kpaC3VkBrz8wLo8B70q4AAPB/h+TEiOTkp0GozQXqP pF/J8m/RjUFwAk5pcm3gxNvyJgET7Ph29jHG6n35vBkAFeEpLdt+msZirgNjz2ETmziU OFFMeoBkL7kMn7OFwymzN+/t3tvxd0F8qp5lHlNNdtp/P+8pe/d+Oh+wJ3rJiQIloJwX MDKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YOT8FudQMJJi2VQkW3sean7qXbsMMLITRTldBXKc6MU=; b=YvdEtLkw3YTcYzU9F8KOkajeB7UrnBXuRAngrFCcdndcQ3MEPMXkfOqFBUdm51wkR0 LhEzPliY0qz2o2zLQ9vYq6PceGEuik0RoPCeBP1v3PH5Jw1Y8DFBnD4OWA3P/bHCQpzy SB8ZVgSTlj8kdFrsX4mOGN0jLrS8poZ84ZMdnyuTy1/CwTqRfoQZtCj3zTX/xRwniFu/ dfCwxFezxAbwedp0dGzwLs1wu3BncZgWMq/nBC5MW/cktRHYYddutZU1bZFiPvvCjwUw Ind+EK233+DHLJF1b9c9lotht2L0Weutfwz0zeKXOgjkAHOUs1dQsbO03s3DtSH6msHr 2YNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si293972pgn.824.2018.03.19.11.38.58; Mon, 19 Mar 2018 11:39:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935734AbeCSShV (ORCPT + 99 others); Mon, 19 Mar 2018 14:37:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54110 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032127AbeCSScy (ORCPT ); Mon, 19 Mar 2018 14:32:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5D7591292; Mon, 19 Mar 2018 18:32:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Enric Balletbo i Serra , Felipe Balbi Subject: [PATCH 4.15 47/52] usb: dwc3: of-simple: fix oops by unbalanced clk disable call Date: Mon, 19 Mar 2018 19:08:45 +0100 Message-Id: <20180319180737.572313960@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180734.976730813@linuxfoundation.org> References: <20180319180734.976730813@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Enric Balletbo i Serra commit bff52352e0ccc2481f2b6b0d612ff8ff56c50f3a upstream. dwc3_of_simple_dev_pm_ops has never been used since commit a0d8c4cfdf31 ("usb: dwc3: of-simple: set dev_pm_ops"), but this commit has brought and oops when unbind the device due this sequence: dwc3_of_simple_remove -> clk_disable ... -> pm_runtime_put_sync -> dwc3_of_simple_runtime_suspend -> clk_disable (again) This double call to clk_core_disable causes a kernel oops like this: WARNING: CPU: 1 PID: 4022 at drivers/clk/clk.c:656 clk_core_disable+0x78/0x80 CPU: 1 PID: 4022 Comm: bash Not tainted 4.15.0-rc4+ #44 Hardware name: Google Kevin (DT) pstate: 80000085 (Nzcv daIf -PAN -UAO) pc : clk_core_disable+0x78/0x80 lr : clk_core_disable_lock+0x20/0x38 sp : ffff00000bbf3a90 ... Call trace: clk_core_disable+0x78/0x80 clk_disable+0x1c/0x30 dwc3_of_simple_runtime_suspend+0x30/0x50 pm_generic_runtime_suspend+0x28/0x40 This patch fixes the unbalanced clk disable call by setting the num_clocks variable to zero once the clocks were disabled. Fixes: a0d8c4cfdf31 ("usb: dwc3: of-simple: set dev_pm_ops") Signed-off-by: Enric Balletbo i Serra Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/dwc3-of-simple.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c @@ -143,6 +143,7 @@ static int dwc3_of_simple_remove(struct clk_disable_unprepare(simple->clks[i]); clk_put(simple->clks[i]); } + simple->num_clocks = 0; reset_control_assert(simple->resets); reset_control_put(simple->resets);