From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221519; b=tPSHSM9/34ber+GgDPmRA2o2xS+Xq8QgJcZHAJhqHdG2pMBJQg5vojBVzzTtWdXc1ixP +qNwu9Yzp22yra4/1bwFkF3nNAQeWtzKZYEHVzi8uQlfYAgz/zXPBpwQX+y/zT0q9AUGu SFG9q4m67eeLnKvJj6uVe/v9EoSOcFys1uaogm1L621bl8r5enirMgKd12Kd44uuBrxRO rrK8cOqEV7HapBa7Vwl5Ej0WP7+/WI+/4VdRQ+KNljxUft7iBZKpUuEKFZlRIVzym5ttV sE7Fq+V0VuxifUWI+0M4fgzlciize2Grfb9mzogwqbup5TXRppIS8WLx/kzpOnwBN2Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221519; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=6mfGhVq2nrnd2rnJQG6KBRXHC6IKJPhBRe4+vCBIj6Y=; b=Ahqg9HRBUtW6K0XgY1AOYSOD2bHF8DOBv15gmYdZIVUxDuWMVQ4C9+s5RuSiW8HNOcAY pHRoQ+iSVgzMW2X4wp33YVqvhR2cfYHhCv2LFovTasTIbNFAMelhEZOnJNH1n41Rz8rGB SlgomJHdAsdoHdjjZdwAedeGB8XaPSkL6JTI6yhbhq22n/bmhOFDE9Ixx+gj+idufPwZF 8CHQu9jRLu1pYxUcg5o3lwr/F18Aum5Nuu+jehLIfjhqnHWr6RlkveLqgrhyZpOO0r3WC Id2LCQ0MnGhOmGKSLx7kRc4hTuoYzIvd31FgC8mgX2VhNcnKUeoPBAh8OM8q2aGxY+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NNLOZWdC; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1BDB606A31A for ; Wed, 2 Dec 2026 14:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NNLOZWdC Received: by smtp.kernel.org (Postfix) with ESMTPSA id A766E1F00897; Wed, 2 Dec 2026 14:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221519; bh=6mfGhVq2nrnd2rnJQG6KBRXHC6IKJPhBRe4+vCBIj6Y=; h=Subject:To:Cc:From:Date; b=NNLOZWdCLZ2Qt8CMrtdgVd4KUrZzSz7Gy9I3z6DkE+xn9XQFcU/WKeYeU9hwUp+q6 BT1J9lwpAg95GGbQOENlgaBbFoyD3vr44vivBudhVeiarW1Py9omgI+msD3qtXqO2N 6gUGb+vKjpMRWLW0nUFLghMOHMMD0y4Yfe5CxMbE= Subject: FAILED: patch "[PATCH] scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper" failed to apply to 6.6-stable tree To: stanleyjhu@google.com,bvanassche@acm.org,mkp@kernel.org,peter.wang@mediatek.com Cc: From: Date: Wed, 02 Dec 2026 14:54:13 +0100 Message-ID: <2026120213-scapegoat-fidgety-cb7e@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x cbab12e5b4a7f49d5add4301de275351269cd431 # git commit -s git send-email --to '' --in-reply-to '2026120213-scapegoat-fidgety-cb7e@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From cbab12e5b4a7f49d5add4301de275351269cd431 Mon Sep 17 00:00:00 2001 From: Stanley Jhu Date: Thu, 29 Oct 2026 15:08:37 +0800 Subject: [PATCH] scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper ufshcd_clkscale_enable_store() and ufshcd_auto_hibern8_update() resume the UFS device W-LUN with ufshcd_rpm_get_sync() and ignore its return value. For clkscale_enable: 1. The W-LUN is runtime suspended and clock scaling is disabled. 2. User space writes 1 to clkscale_enable. 3. ufshcd_clkscale_enable_store() calls ufshcd_rpm_get_sync(). 4. The W-LUN runtime resume fails and the W-LUN stays suspended. 5. ufshcd_rpm_get_sync() returns a negative errno, which is ignored. 6. ufshcd_clkscale_enable_store() enables clock scaling and resumes devfreq while the W-LUN is still suspended. For auto_hibern8: 1. The W-LUN starts a runtime suspend. 2. User space writes a new value to auto_hibern8. 3. ufshcd_auto_hibern8_update() sees that the W-LUN is not yet suspended and calls ufshcd_rpm_get_sync(). 4. ufshcd_rpm_get_sync() waits for the runtime suspend to finish and then runs the W-LUN runtime resume. 5. The W-LUN runtime resume fails and the W-LUN stays suspended. 6. ufshcd_rpm_get_sync() returns a negative errno, which is ignored. 7. ufshcd_auto_hibern8_update() writes REG_AUTO_HIBERNATE_IDLE_TIMER while the W-LUN is still suspended. Add ufshcd_rpm_resume_and_get() wrapping pm_runtime_resume_and_get() so failed resumes drop the usage reference automatically, and return early in ufshcd_clkscale_enable_store() and ufshcd_auto_hibern8_update() when it fails. Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Cc: stable@vger.kernel.org Signed-off-by: Stanley Jhu Reviewed-by: Bart Van Assche Reviewed-by: Peter Wang Link: https://patch.msgid.link/20261029040003.2100003-3-stanleyjhu@google.com Signed-off-by: Martin K. Petersen (Oracle) diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h index e55c2a02c1f5..99f654b79035 100644 --- a/drivers/ufs/core/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -388,6 +388,11 @@ static inline int ufshcd_rpm_get_sync(struct ufs_hba *hba) return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); } +static inline int ufshcd_rpm_resume_and_get(struct ufs_hba *hba) +{ + return pm_runtime_resume_and_get(&hba->ufs_device_wlun->sdev_gendev); +} + static inline int ufshcd_rpm_get_if_active(struct ufs_hba *hba) { return pm_runtime_get_if_active(&hba->ufs_device_wlun->sdev_gendev); diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index b85b88e4c308..9cb009a6acbe 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1864,7 +1864,9 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev, if (value == hba->clk_scaling.is_enabled) goto out; - ufshcd_rpm_get_sync(hba); + err = ufshcd_rpm_resume_and_get(hba); + if (err) + goto out; ufshcd_hold(hba); hba->clk_scaling.is_enabled = value; @@ -4792,7 +4794,8 @@ void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit) WRITE_ONCE(hba->ahit, ahit); if (!pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) { - ufshcd_rpm_get_sync(hba); + if (ufshcd_rpm_resume_and_get(hba)) + return; ufshcd_hold(hba); /* * Serialize with the host driver's AHIT control. Skip the