Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp193896pxx; Wed, 28 Oct 2020 02:20:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5lS9QBBAv0jybMRT8U0mx5mpL2k74KQ7oKv/a4MoXnQpXuk/tGGFaoMf6St4RIpNsio7G X-Received: by 2002:a05:6402:4c6:: with SMTP id n6mr6808863edw.204.1603876819826; Wed, 28 Oct 2020 02:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876819; cv=none; d=google.com; s=arc-20160816; b=1HYDX1jLEBkt1XcqVX69bcwrNibhX8wzdwQuwvJvQ6ACTDMr2cX1fojsGpc731cY8m /XGnHsncgMhoU6kzZVvU44GJjSDqLD56Zu5vVTwytYtDsruBOlmnLbShsinxwdSCjss9 6TfakJupAxoyqRxrg4V5ulj0RiTP7/thLiC0ogUfr1suIKHDaxFiNgCut2WBt8x4nios Awr3LHSGD7VcRxnNvkDsuTj1s10muml05hKCFBTpXiulPTsHIFICY3mTW2zNHg1u/eL9 /Vmi0YOuNJmvoxUcPUUJslKjs/k2wbBKiOV1Ij5v3LdMxtUKMCC8LrVVuqzb2+gKBat8 Zf/g== 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=zWhhvY+RubuhLv1+aZZwfdgNGVkbjfT4j/VM70c0c2I=; b=WavPZnxBAHRZgXgHKARZK/QEdfYfIQtDeZLyoxzK8EbC4TPBhdkdmaN/ouZ/kacZ1U /zSjr43IH+a7VN7130rgdCCnlkXTz5/U8PUlcSJeXUgB/G2FiwiIuyttJ0lZX6rHUWK7 Dzxpj+hVhWGb5YlDwcrr2vdg6g75yrJcAUg7h19GEfRGLQhHNNLmc4kwbWpZlM6zfNbe nRR1KYXA2OisXOL6rdJAPG3CDMnPUUxzrootoIody5MlWqrQ5zNlTcRbHLEcoD7j9K9N nI75ktOQhqqrrqAvDQIT+8ZzPHh4wWdD6PD9I2SSorxVhGlCnLJfAxr7xszZWY60MQs9 icpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WbCrpuum; 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.02.19.57; Wed, 28 Oct 2020 02:20:19 -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=WbCrpuum; 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 S2901107AbgJ0OTB (ORCPT + 99 others); Tue, 27 Oct 2020 10:19:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757091AbgJ0OQO (ORCPT ); Tue, 27 Oct 2020 10:16:14 -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 414812076A; Tue, 27 Oct 2020 14:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808173; bh=bgtKm3nXHAJrgo0PPg5JzJ+PX4/ItlVoSYtZa0l4BFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbCrpuum7AgaAVV0BIQyf1tnzlvQq7yMv9iXm1QpN05yUHL9HKp8UgTGnXWo5r4j/ F5IiYFnuc9iWG9Vam2MGvA8XmUliD/Uv688qlC9gFgMSr8kPucfE5zjB/UKSTF7/of HWwWSV5gLXRPT4pW2uLicXd+Uvzoazfm9iJ0ZLVc= 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 4.14 184/191] scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() Date: Tue, 27 Oct 2020 14:50:39 +0100 Message-Id: <20201027134918.578439550@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 ee3589ac64abf..6b6b8bf2ec929 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1595,9 +1595,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); @@ -1610,8 +1607,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