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=1796229301; b=LMY9MPlsaM1HKjFIHk4d6fNF9yVebVImQHYOWEBe+5WnneX0axOhVBhz9QyfZ2cqY0ff SmWmkRkjH0R3yg82HM+hePo4HzZMePgmJqlKVzFEFhyoDDbgAgGEeu6Rm1+iqZUC8zLR1 0q2Mn2DPbp4yZA8tmmQeOruxRWX7mIq1CII+VOMC03hLTV1u3X507Pz7MXD7MRPEuCr8/ mhqnLlwG5+CYFM3cJVN6pHyFK0GvuKJVLQkIeaDnGVYP6IrfjRPS9Zqfd4tOCGL3IbykV F2aph3OL8+AHg+K7/h7OgHh65V62p5JV0ULNG2p1TxkVi8cmJbPIQE79fSBCtY7kT6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796229301; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=+F2ep4YJVh30MhBj7uagh65AkRAa9SXAm0DlTy1bRcM=; b=WQrzkNt23iQ6siS9Crj3XJSLAtUkvR3RatvGmLdLbBgcAmM5M+Xl42NWg4hZvaYQaEIB Kwqzn7yiAvRe0VA7JXXtVHAvmiEHHnmFHlu53OZfExfdFEJz0LeonZPyOxVPoFKm95R7H g2wCT4XTdZ4kywpjhw8qBYTa6PR+Kd9FrdOsLzXvDfiLfMp7+sqfTHDILn1rSO5sCP/4w LYBwJQpvUE9WWgePUJroePZbm6Y/QuXBKYs1MkFBcK9UR+CJZO6KZeSPO7W99YtnROzAr 8Z3H6eojzsmdAw7YhnVHTUY1HW/nO0Za8CC9l7aDUyZHCrqVycF4kucZrthbjku88mQ== 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=N8JdD0ib; 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 589F5606A325 for ; Wed, 2 Dec 2026 16:35:01 +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=N8JdD0ib Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9050A1F00897; Wed, 2 Dec 2026 16:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796229300; bh=+F2ep4YJVh30MhBj7uagh65AkRAa9SXAm0DlTy1bRcM=; h=Subject:To:Cc:From:Date; b=N8JdD0ibd9oC+87dygGTg96UIdAIP9nnkjH9KAzPrqwAhpcvCr1qvPv5yUOArfsSS wzdoT69os7GhMe3QcGWjVgvqfyhI3/pnoIDJ/oiPlcBmeQ0zLd3PnvwViEezokT6ZM Z/FdE2zUi3Vb0DDsDXpbH7yCOBKl7A0k2i2Ni0RU= Subject: FAILED: patch "[PATCH] scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume" failed to apply to 6.1-stable tree To: stanleyjhu@google.com,bvanassche@acm.org,mkp@kernel.org,peter.wang@mediatek.com Cc: From: Date: Wed, 02 Dec 2026 17:08:36 +0100 Message-ID: <2026120236-unframed-perkiness-c697@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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x 2b8541edf7c43f0294c45d2e687bbc1288292f4e # git commit -s git send-email --to '' --in-reply-to '2026120236-unframed-perkiness-c697@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2b8541edf7c43f0294c45d2e687bbc1288292f4e Mon Sep 17 00:00:00 2001 From: Stanley Jhu Date: Thu, 29 Oct 2026 15:08:39 +0800 Subject: [PATCH] scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails 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) diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c index baf6ae917d36..8df1a2c6abf6 100644 --- 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_job *job) 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) {