From: Peter Wang Date: Wed, 24 Sep 2025 09:43:27 +0000 (+0800) Subject: scsi: ufs: host: mediatek: Fix shutdown/suspend race condition X-Git-Tag: v6.19-rc1~95^2~42^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=014de20bb36ba03e0e0b0a7e0a1406ab900c9fda;p=thirdparty%2Fkernel%2Flinux.git scsi: ufs: host: mediatek: Fix shutdown/suspend race condition Address a race condition between shutdown and suspend operations in the UFS Mediatek driver. Before entering suspend, check if a shutdown is in progress to prevent conflicts and ensure system stability. Signed-off-by: Peter Wang Acked-by: Chun-Hung Wu Link: https://patch.msgid.link/20250924094527.2992256-6-peter.wang@mediatek.com Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 2a69b4cede222..c00e62adbbda8 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -2425,6 +2425,11 @@ static int ufs_mtk_system_suspend(struct device *dev) struct arm_smccc_res res; int ret; + if (hba->shutting_down) { + ret = -EBUSY; + goto out; + } + ret = ufshcd_system_suspend(dev); if (ret) goto out;