From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349213DA7CD; Thu, 15 Jan 2026 17:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499958; cv=none; b=IMwM6WA4VpiW6uGFkDovYN8FzYg5QxDSus9noAJl5rcgD2yCEI9e2BFUIPaiMGgnEs6BHE7ICTzCZA1SXRaW+7z7A4SG/zaaCyOX/ufD1uhYWrD/yhK17hpoUs+iFAphkExtufunADFDf0zGVTW89JyyL5r9t/fncwnmCqBulaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499958; c=relaxed/simple; bh=n6+/Uq/sRD1URmaWLQsBzGbpz0rXfCLiUx4O08a4h1w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r6gqtlS91/yyZqguDtWw/42xSZOscx7nacYfHLVvBm/8Azo7VVOxorQ9i4vIqMYcjoVUcBvOww/QptcdfRQh+sv0ycnvL7GCNV+yXAq0sTBHjDuxr8/hA33AKITXsQ9X92zAHEpLIMI2jdg7pjBTQ2MlGYCvVupP/davxox+9tM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iSJGdLkR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iSJGdLkR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82024C116D0; Thu, 15 Jan 2026 17:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768499957; bh=n6+/Uq/sRD1URmaWLQsBzGbpz0rXfCLiUx4O08a4h1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSJGdLkRQSWKvcUFCVprFkh2Yrx16qpU1U99j8KkL3GjreogGcmTf1dQS0AjAk7Mg wd0/24Mha2v/MvnPYR8TCwEcwpuCWry8DNuRx2F6MeCxu7+Fp91r3w/ZkHyReJ47vv ztQV0ue9tqVv1gQbN+onasuQ5mKttR4u3AGJfuT8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sanjeev Yadav , Bart Van Assche , Peter Wang , "Martin K. Petersen" , Shivani Agarwal Subject: [PATCH 5.10 407/451] scsi: core: ufs: Fix a hang in the error handler Date: Thu, 15 Jan 2026 17:50:08 +0100 Message-ID: <20260115164245.664676513@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164230.864985076@linuxfoundation.org> References: <20260115164230.864985076@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sanjeev Yadav commit 8a3514d348de87a9d5e2ac00fbac4faae0b97996 upstream. ufshcd_err_handling_prepare() calls ufshcd_rpm_get_sync(). The latter function can only succeed if UFSHCD_EH_IN_PROGRESS is not set because resuming involves submitting a SCSI command and ufshcd_queuecommand() returns SCSI_MLQUEUE_HOST_BUSY if UFSHCD_EH_IN_PROGRESS is set. Fix this hang by setting UFSHCD_EH_IN_PROGRESS after ufshcd_rpm_get_sync() has been called instead of before. Backtrace: __switch_to+0x174/0x338 __schedule+0x600/0x9e4 schedule+0x7c/0xe8 schedule_timeout+0xa4/0x1c8 io_schedule_timeout+0x48/0x70 wait_for_common_io+0xa8/0x160 //waiting on START_STOP wait_for_completion_io_timeout+0x10/0x20 blk_execute_rq+0xe4/0x1e4 scsi_execute_cmd+0x108/0x244 ufshcd_set_dev_pwr_mode+0xe8/0x250 __ufshcd_wl_resume+0x94/0x354 ufshcd_wl_runtime_resume+0x3c/0x174 scsi_runtime_resume+0x64/0xa4 rpm_resume+0x15c/0xa1c __pm_runtime_resume+0x4c/0x90 // Runtime resume ongoing ufshcd_err_handler+0x1a0/0xd08 process_one_work+0x174/0x808 worker_thread+0x15c/0x490 kthread+0xf4/0x1ec ret_from_fork+0x10/0x20 Signed-off-by: Sanjeev Yadav [ bvanassche: rewrote patch description ] Fixes: 62694735ca95 ("[SCSI] ufs: Add runtime PM support for UFS host controller driver") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20250523201409.1676055-1-bvanassche@acm.org Reviewed-by: Peter Wang Signed-off-by: Martin K. Petersen [Shivani: Modified to apply on 5.10.y] Signed-off-by: Shivani Agarwal Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufshcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5766,10 +5766,12 @@ static void ufshcd_err_handler(struct wo spin_unlock_irqrestore(hba->host->host_lock, flags); return; } - ufshcd_set_eh_in_progress(hba); spin_unlock_irqrestore(hba->host->host_lock, flags); + ufshcd_err_handling_prepare(hba); + spin_lock_irqsave(hba->host->host_lock, flags); + ufshcd_set_eh_in_progress(hba); ufshcd_scsi_block_requests(hba); /* * A full reset and restore might have happened after preparation