Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3064448pxj; Mon, 17 May 2021 16:52:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHl2w1lpcrLUWbLqg7rzAW4/AQ1KdkjjlBbYi/ibXdVNFs33b9KCUMJ4ViBKzmKYneTyem X-Received: by 2002:aa7:cdd8:: with SMTP id h24mr3223616edw.276.1621295524822; Mon, 17 May 2021 16:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295524; cv=none; d=google.com; s=arc-20160816; b=t+zxhpCm0LfjuxUcfJZswDsvWdG/a3GkmMHbKZCgR0Tpp+p8xbAGbbBfOFGiOBePNZ PggBXYX9flSb1nP98ORh/mtVGO1BmbSzIykF0sS7/zPxqcJcRRfcc0SargOsHMHMJf7K EXlBiUUiReJmeB2GThPdreqxyRE8uoJOA9O8V5G4Yq9aSzsbp06SdtY/YxqS0+tjC2dU WayAbMdJPC9Jl8CaAU8veyJO+v2ZhymLAFhifmnYqGuQu/aoHHkoVZ1s5hVQpkoo2WNu 8Kn6CyROgtTCz2FduqOeX54r4VG/+0muQDu2Dw7Oc7tJ5+zPm746VTrJzz09slxsa9Wc DHgA== 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=/XGrd5jWfRLn6AzuLvTV5NOZXhbIR9HB02QSSBsHqr8=; b=o7GjjIGZror2cI3EeJWO0Qgd9BfB9z7CwGVUwJcvo5FRol+2ofrrdXOWstA72lHNWR WXLOHoGm2ioOhGNSZpcoLDOOoBoaK8HHZ19RTac9waPE6Z0DngCze207L+vOjrJ/L5Gf usTPAZJ3wTE+4d0UqQwzxh/EfRqPRz5o0i7OYEIcxeAmnIhRv0Y15LpVl3I3wrHftP2i LRobAESNRTAt51vAzd0SiT+FttoJfgsgbPCTLsm6za4+sq29slVpFd5UdqRKtubh2PZb +RYMRTTwqfixDPYGfJkdMg8PZag14OyexFX3iMkTqryqMWQolpfjE8s+A1YJDzwEgbOg 3MVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LaU5mj9G; 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=pass (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 b10si18054047ejj.523.2021.05.17.16.51.41; Mon, 17 May 2021 16:52:04 -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=@linuxfoundation.org header.s=korg header.b=LaU5mj9G; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239088AbhEQOXy (ORCPT + 99 others); Mon, 17 May 2021 10:23:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:35960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239506AbhEQOU0 (ORCPT ); Mon, 17 May 2021 10:20:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBBE261442; Mon, 17 May 2021 14:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260673; bh=SvmAOzvBXIJjTkdfh5SVQyJbmwM8zlUHiP2hORC6ijc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LaU5mj9GGpkQbduArJ/s1pdFvbx48JGSAhXt1JlOCmuxIBtQfp5eP1dQmiZDleAXR Ys15XtoeQDEDE3pZdB2emEuZKZNjCLM2dMlw0LevDRdyPdguuU0DWPL4TtN46oPWAv 46PiSj1EzdhhfCWWDBu/MEtQlNRpod5RQ+Jj6EpM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daejun Park , Can Guo , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.12 189/363] scsi: ufs: core: Cancel rpm_dev_flush_recheck_work during system suspend Date: Mon, 17 May 2021 16:00:55 +0200 Message-Id: <20210517140308.983171280@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 637822e63b79ee8a729f7ba2645a26cf5a524ee4 ] During ufs system suspend, leaving rpm_dev_flush_recheck_work running or pending is risky because concurrency may happen between system suspend/resume and runtime resume routine. Fix this by cancelling rpm_dev_flush_recheck_work synchronously during system suspend. Link: https://lore.kernel.org/r/1619408921-30426-3-git-send-email-cang@codeaurora.org Fixes: 51dd905bd2f6 ("scsi: ufs: Fix WriteBooster flush during runtime suspend") Reviewed-by: Daejun Park Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index fed32517d7d1..4631a609b0e3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8978,6 +8978,8 @@ int ufshcd_system_suspend(struct ufs_hba *hba) if (!hba->is_powered) return 0; + cancel_delayed_work_sync(&hba->rpm_dev_flush_recheck_work); + if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) == hba->curr_dev_pwr_mode) && (ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) == -- 2.30.2