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=1796381328; b=yeht7tzqdBzJnqug2yRtpn6c6Y82ArJCUdmFz5TAM1cX3g2QaDXEB5WWXLMCE60S9f+C zUU0kQ+T8QDTbdJHqSeL319x7Kp5jXBgcH3nbo1hTo5S48t1NbzhpRpFILAgVoSCfbnhg wvCD/e3gGxhcOStBI8+tEngHRqpceeE6FxHofrURyC1r4vzW4o4Swk6VlfNaJ1xK7p+Iy oI9MnsOSkLU5XFV14r9zhz9oLGCXKGMpJC0BGhLBCr/Km6QcpImLxmFm1aOMTPzOlMSYi s+TtE0QOtLJPDhqWJ2SaEiQYbUQ2X1KBGZwMgK4IX73WReAl+kMzkmP2IGxG9ywxghA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381328; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=98muMGmaCoqux5HOeVK0ba8sEqvfxDzAHepp5JMp1II=; b=RqFmmyoZGnzISHl0xkYiNftHJKDZ/36JfwETgAkSBKGiVkF9X7bw9Lgz14qz3rp1QQJE +R5InjyAC9alVWfL4cmjhaFkYPCV1mapWNjhh3zZsdtfFZDBVV5vMeA/22Y3VZwUZOTg/ N9J4FBOkjT5r6MSnAe2wJHNGioyV9rH8hp0qX5fj7uATEXgcIO2jVms4yMHDTQrrvcIUU /vStoj9HBT0hlJ4I5IEHFioJGEC/HJwp6mmp0P86BCRa11WNU9eE8jUdIMjgqOS8SOe1C sfGGrNLPy636TLW7eji7EmkXsd+6UXRiuB8I0N1jesLnAMfZ+x9W9TCzFLeL2iTnW3A== 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=GGUq+6rQ; 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 C7D70606A32D; Fri, 4 Dec 2026 10:48:48 +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=GGUq+6rQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46A451F00897; Fri, 4 Dec 2026 10:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381328; bh=98muMGmaCoqux5HOeVK0ba8sEqvfxDzAHepp5JMp1II=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GGUq+6rQQXP3ijWA6h0AedlQkf2QIIFTbwgrJaLnhXWhLRs3izlQYX7HVOk0qzNx3 YDstquqzyCz/dvi5nrBWyfSOPfGRqzL52L7WirD0gNVokvCyveLOfmdoAhnZM2xIu0 cBFoG6k1frbDkP+OGG0yMrznng7HYaudR4PnarxE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stanley Jhu , Bart Van Assche , Peter Wang , "Martin K. Petersen (Oracle)" Subject: [PATCH 7.3 654/742] scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails Date: Fri, 4 Dec 2026 19:08:38 +0900 Message-ID: <20261204100652.456233297@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stanley Jhu commit 2b8541edf7c43f0294c45d2e687bbc1288292f4e upstream. ufs_bsg_request() resumes the UFS device W-LUN with ufshcd_rpm_get_sync() and ignores its return value: 1. The W-LUN is runtime suspended. 2. User space submits a BSG request. 3. ufs_bsg_request() 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. ufs_bsg_request() dispatches the BSG command while the W-LUN is still suspended. Use ufshcd_rpm_resume_and_get() and jump to out_complete on error so the BSG job is completed via bsg_job_done() with the failure code without dropping an unacquired runtime PM reference. Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Cc: stable@vger.kernel.org # needs "scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper" Signed-off-by: Stanley Jhu Reviewed-by: Bart Van Assche Reviewed-by: Peter Wang Link: https://patch.msgid.link/20261029040003.2100003-5-stanleyjhu@google.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/ufs/core/ufs_bsg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/ufs/core/ufs_bsg.c +++ b/drivers/ufs/core/ufs_bsg.c @@ -150,7 +150,9 @@ static int ufs_bsg_request(struct bsg_jo goto out_complete; } - ufshcd_rpm_get_sync(hba); + ret = ufshcd_rpm_resume_and_get(hba); + if (ret) + goto out_complete; msgcode = bsg_request->msgcode; switch (msgcode) {