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=1796382732; b=cK00VCteoJIbnIEAkkZUUEilI6K3ukoT2EBLNwINBBpU5/8GxFP0bc/gKpJYWpdk9OpJ tX9KoKdZEcjtju3jCUUAockQbYa26kCvDS460SRjPRL4fcv9fe+aTJApHp4oZiU9Kc7b5 zzvXUpiOq++IU1ds67QqaE16k8fwLmyKpIrCgC335SJWwhCM/htwCw0z7hYy4RWlfWqSQ APze9v7K5tiOpcLquXx+8iCdCiYJhvwxwmszVuFjyrFrzMAJjz3+FA9PDFXBFZov5TTRa j3FOawY451qOtQ/d9tkC530ivywU8CQ4gxDmZ0rRxH9SH+Zxoq5lwF8vLtugKSZqTkg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382732; 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=SxCt+H/usFWwmLAMHA1pCuO2ntr1HseuB8pL62l7p/0=; b=Yw5FDMrXagGnEy5kFaOeWQUbQBFM0z+BSfdH95ilISTR2GIkOryy5DQO22QIloR5S2pt 8hkmaUPvAlMvFXSvWpekptuEo5ZVhmD6FDyyVF41DAVsJUyxz0SgX2csrrGz5auQGLw38 k5szG9S/ZrA76fOJ0ldzgk81xZfdSlROULVpNV0pLUGeYUUENq2f2XLDj+zVOUzhbtfmR tLgPp78S9ioNftLP+5eMMNDf2ZzOsufYue/PX9Vc/kcDRTqt3P+TBTmzKLO37hl1HqROw pRG/y9UhKMmhPn1LUsP1Z8DUR2c7GXQiz2zVwzSNeMLD5mQc9PCQadqIXgfJ2UA9h7A== 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=o+LTVewl; 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 31AB3606A32C; Fri, 4 Dec 2026 11:12:12 +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=o+LTVewl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71C731F000C2; Fri, 4 Dec 2026 11:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382731; bh=SxCt+H/usFWwmLAMHA1pCuO2ntr1HseuB8pL62l7p/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o+LTVewly6CcBgHeSTkMmLvxomrpy5khedipFgYsp19RjJEjysmhuzdmP0TWQDkeB sm4Dbe4E55cgq+9PFeLuFslB3CDOSaxfU4WnJcwK+NFwkgpBeEPTk4Y889BKGiPSBb j6n+Hk8UxSqHHbNlrfX3pLZ8xXvSPUZh+I/2WTns= 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 6.18 578/703] scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails Date: Fri, 4 Dec 2026 19:07:57 +0900 Message-ID: <20261204100643.137785913@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -152,7 +152,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) {