From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7CDD1397 for ; Mon, 26 Jan 2026 03:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769397586; cv=none; b=c8ayc8cwR4np3/MW4qgsuwARM/jDgoZPQgaXt5k0d8s6jFEa583jYz/d4XzOZ38ZaMh8iqxm+oOqZDBrcbcH8OOkqlXi7ibSltnoMQWOifjkc/SqE8jfwArs8KUVFArksQp03mKRhijIKhOYTLKlizeT02dUcx3xoIr5/ylb3j0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769397586; c=relaxed/simple; bh=KkgrRt/tazgCm9YVHO6D5hEY9Hx4T/GzdiqYhZoLhLk=; h=Date:Mime-Version:Message-ID:Subject:From:Cc:Content-Type; b=teg9aW1FurzKQ7hJNpmO9sbjBRRABdcA4eW05Hzv8kwRlEiiAfhNzDmeWRvVN4yXInazQiXlwhDOjhaVTGNER8OIPExSo4M0f/lIIxbYtXgD9SpVmQQvesa/eyf1jdfwnqPyDA9ex1lKMx6ErJRKnWQr7zhm0W+oLG8Pc0l4fwM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--thomasyen.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZdpRZ6AV; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--thomasyen.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZdpRZ6AV" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a7701b6328so71091025ad.2 for ; Sun, 25 Jan 2026 19:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769397584; x=1770002384; darn=vger.kernel.org; h=cc:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=gcCuKusoA/00VOO+KPUKBQ28Re2pog/ilG38/RbjoZk=; b=ZdpRZ6AVEn4S9/tjLTPxIpuzqtNltUKTzySXBRRsmReR4Rw01yCYDHZuetYN3S6Y/2 L6Tts/PvBzmrULE61V1kQze1uOdGoF8vvJrG2yqgIVadpG3vsk7qjal2NrHfOswQ8Bk/ PgnNN7jflGpETzP3TJwxFmF/xx7Xb5EUwbZlEALa/17tqMUQkkpQMAu/GuLLdp5NWxWB 5LFyGxXShM2ZpLEhEaDHbMc+UhwMqXQfV/545KVlFvW4KmDRUTGYItDOEgMqDCp/FH2t s6+oQ0xw3l6hyseE4mpx+xQ/gEgecPXqOBItPoR5S822voQeiX343qBDIPmP3KCysOO6 LS7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769397584; x=1770002384; h=cc:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gcCuKusoA/00VOO+KPUKBQ28Re2pog/ilG38/RbjoZk=; b=AVqEmzXmq/kDHGBZwAgGOJQDal+8pP13zF9kOYZ+RrLGyecK5CDMnAiWDOLWFpisIU 55vZj8goc9qfWqTsQpyJ2ZWHJASQKGO0kGoIeUeONb9oP9kNY+sn61AaxcVUup/eEVbR r8GsVjnUlJDiJ1xvSmlyND9kpeknCXQx9NFm4IY84kTj8u8/B4QHCx4tMZiGqQU4/czs Tn3pwqt5BX7ITMxtnGyUeRZE40XfeTlYHf3wX0WLZALuYyz9UJ29NeNqm73MbS2rsNoj Sek8Wup0CWrJxffom5xLYOCIpXnnL1YqUkTYQ9qOhwRKsZgEO4iDxDVgFbHaZVWUhnPs WrWg== X-Forwarded-Encrypted: i=1; AJvYcCX4IKq5DsMS4l8fw8hCD3doLYCNm46QgFhjibJXTBnAZRbf8d/jwiOSeC/3FsRbBgL7pYD3hprDpwZqRuM=@vger.kernel.org X-Gm-Message-State: AOJu0YzbOs3G2amoPZgpjfCrwVggeV675IWPrP8n5ir9XR91P7Y1qaMn iA/Z4xxFW1XMQr/TRbRDXO2bVgZlPTRkVE/6J+e+QTPLYEey6CDC0KejCuf41cyRmOcYSQ8uawx zufSSiD4NhQJWcOgNvA== X-Received: from plge5.prod.google.com ([2002:a17:902:cf45:b0:2a0:835a:fa57]) (user=thomasyen job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ceca:b0:295:5da6:600c with SMTP id d9443c01a7336-2a8451f9260mr33078155ad.2.1769397584006; Sun, 25 Jan 2026 19:19:44 -0800 (PST) Date: Mon, 26 Jan 2026 11:19:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260126031921.2511736-1-thomasyen@google.com> Subject: [PATCH 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero From: Thomas Yen Cc: Thomas Yen , Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Peter Wang , Bean Huo , Adrian Hunter , "Bao D. Nguyen" , "open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER" , open list Content-Type: text/plain; charset="UTF-8" Ensure that the exception event handling work (&hba->eeh_work) is explicitly flushed during suspend when the runtime power management level (rpm_lvl) is set to UFS_PM_LVL_0. When the RPM level is zero, the device power mode remains active and the link remains in an active state. In this specific configuration, the UFS core driver previously bypassed the flushing of exception event handling jobs. This created a race condition where the driver could attempt to access the host controller to handle an exception after the system had already entered a deep power-down state, leading to a system crash. By explicitly flushing this work before the suspend callback proceeds, pending exception handling tasks are guaranteed to complete, preventing illegal hardware access during the power-down sequence. Signed-off-by: Thomas Yen --- drivers/ufs/core/ufshcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0369043ca010..3a0e6c9ba86a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9997,6 +9997,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE && req_link_state == UIC_LINK_ACTIVE_STATE) { + flush_work(&hba->eeh_work); goto vops_suspend; } base-commit: a48ca06cf343423faa01c573aeafba9fa5f92577 -- 2.52.0.457.g6b5491de43-goog