Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp303442pxx; Wed, 28 Oct 2020 05:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc7gcLWEb4XKrrW+kz0IdthDiwmfpLFXVzpSWgq7o89ra80s3XNzPsx8KYHAHlE8jW/JNq X-Received: by 2002:aa7:d28c:: with SMTP id w12mr7480300edq.248.1603888021067; Wed, 28 Oct 2020 05:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603888021; cv=none; d=google.com; s=arc-20160816; b=cVrLl1+/MQasffJAbU9wUurNnR/WmVAToZ5mOmwb5iax5rDvbA1fWs+OzU9RBZFJPe DJ/NxHikNVI+BxOPu38pNDnmaMQzyXrCcPlhoM6EYz7oDS39ASjTMyxdlNcVOwGBLYBC ih7RK9QEUChgMTC1avhXqQvPLBnLUBkoRf75vOho3dtcj4y3i+KKG6cBev2WnMbIqLfV g/m8uRMXPwKUVw9fU30s5qjNAMmgGxhy0xXb25LMScl9L2XsX6+2u1GDuJKNnJy/i385 zs5zIMJWTMDvOuJG565BPknmpDMR0NKhiXgiwkefS4Q4b5kYrGOqx4Lt3cF/zoO6yuXO +K/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TSze15mw/1udlV9po9FTmOcP0EYEHCxvoMxQV4R11RA=; b=JAf3igdRFG0ncSzVHyPd/rt7tqnc8EdohkvHTLFiXxlpwhWBnIsiUYHtBnMfyMTg82 x5faVTEuqwrknCqCDj42ZgMDxCAVsq28FU6bwYE9vHNiQeCu4+A39n+X6LcvchXR3JZR Qx6LSSsL/ioMas3iuPQjNFukMU+0BSOsmBGGzDDsygjiETTs86oSGxn9sbZQ17Np7fy3 YSOY3y5vuLjkSGN+XAweZFBdaMuxS4pZw+y8ygENECE9/1aI2220rNt9ImG2Essobjhh CCK4N8F1cop4+MsGLE1Zd8vfwJq/hHDIbzNxW4OTpV2gfwO/2AVLPGdXvlqASh/qAsAI HfPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tCbQZ3Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si3663191edn.100.2020.10.28.05.26.37; Wed, 28 Oct 2020 05:27:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tCbQZ3Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1796902AbgJ0PUd (ORCPT + 99 others); Tue, 27 Oct 2020 11:20:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:54784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796324AbgJ0PRY (ORCPT ); Tue, 27 Oct 2020 11:17:24 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3248A206E5; Tue, 27 Oct 2020 15:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811843; bh=Y/1hHBO6KE75jBvjkA30cN0pMayafi/gat7ttIbSo9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCbQZ3TwRAcuPLyaY9wdbILpGO+AH1BHBhfV3t0sg6UuUGysA4fEGRHjUV2GXACo+ 9SJV69nFn1zO9srs5riBqpFwY8HM7myrkXmz3qbsn12c/dCpdkSlOwc46eJSOTGYQe XGvzO+d2uk18WcrmQzDuzhabzKD+uMkiGczDDs5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongwu Su , Avri Altman , Bean Huo , Asutosh Das , Can Guo , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.8 619/633] scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() Date: Tue, 27 Oct 2020 14:56:02 +0100 Message-Id: <20201027135551.868441793@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Can Guo [ Upstream commit 89dd87acd40a44de8ff3358138aedf8f73f4efc6 ] If ufs_qcom_dump_dbg_regs() calls ufs_qcom_testbus_config() from ufshcd_suspend/resume and/or clk gate/ungate context, pm_runtime_get_sync() and ufshcd_hold() will cause a race condition. Fix this by removing the unnecessary calls of pm_runtime_get_sync() and ufshcd_hold(). Link: https://lore.kernel.org/r/1596975355-39813-3-git-send-email-cang@codeaurora.org Reviewed-by: Hongwu Su Reviewed-by: Avri Altman Reviewed-by: Bean Huo Reviewed-by: Asutosh Das Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufs-qcom.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 2e6ddb5cdfc23..7da27eed1fe7b 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1604,9 +1604,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) */ } mask <<= offset; - - pm_runtime_get_sync(host->hba->dev); - ufshcd_hold(host->hba, false); ufshcd_rmwl(host->hba, TEST_BUS_SEL, (u32)host->testbus.select_major << 19, REG_UFS_CFG1); @@ -1619,8 +1616,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) * committed before returning. */ mb(); - ufshcd_release(host->hba); - pm_runtime_put_sync(host->hba->dev); return 0; } -- 2.25.1