mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stanley Jhu <stanleyjhu@google.com>
To: "Martin K . Petersen" <mkp@kernel.org>,
	 "James E . J . Bottomley"
	<James.Bottomley@HansenPartnership.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	 Bart Van Assche <bvanassche@acm.org>,
	Bean Huo <beanhuo@micron.com>,
	 sangram kumar yerra <sangram.k.y@intel.com>,
	 Rajeshkumar Sambandham <Rajeshkumar.Sambandham@amd.com>,
	Stanley Jhu <stanleyjhu@google.com>,
	 linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	 stable@vger.kernel.org
Subject: [PATCH] scsi: ufs: ufs-pci: Check hba->vops in system PM callbacks
Date: Wed, 11 Nov 2026 16:48:53 +0800	[thread overview]
Message-ID: <20261111084853.3530107-1-stanleyjhu@google.com> (raw)

ufshcd_pci_tbl[] defines the Samsung 0xC00C and AMD 0x1B29 PCI IDs
with .driver_data set to 0, so ufshcd_pci_probe() leaves hba->vops
NULL. Both ufshcd_pci_suspend_prepare() and
ufshcd_pci_resume_complete() dereference hba->vops->name without
checking hba->vops:

1. System suspend on an AMD 0x1B29 or Samsung 0xC00C host enters the
   PM prepare phase and calls ufshcd_pci_suspend_prepare().
2. ufshcd_pci_suspend_prepare() evaluates
   strcmp(hba->vops->name, "intel-pci"), dereferences NULL, and
   triggers a kernel oops in the suspending task.

Check that hba->vops is non-NULL before reading hba->vops->name in
both callbacks so hosts without variant operations use the generic
ufshcd_suspend_prepare() and ufshcd_resume_complete() paths.

Fixes: bb44826c3bdb ("scsi: ufs: ufs-pci: Fix S0ix/S3 for Intel controllers")
Cc: stable@vger.kernel.org
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
---
 drivers/ufs/host/ufshcd-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/host/ufshcd-pci.c b/drivers/ufs/host/ufshcd-pci.c
index 668b57403e62..f9abbbc436f4 100644
--- a/drivers/ufs/host/ufshcd-pci.c
+++ b/drivers/ufs/host/ufshcd-pci.c
@@ -644,7 +644,7 @@ static int ufshcd_pci_suspend_prepare(struct device *dev)
 {
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 
-	if (!strcmp(hba->vops->name, "intel-pci"))
+	if (hba->vops && !strcmp(hba->vops->name, "intel-pci"))
 		return ufs_intel_suspend_prepare(dev);
 
 	return ufshcd_suspend_prepare(dev);
@@ -654,7 +654,7 @@ static void ufshcd_pci_resume_complete(struct device *dev)
 {
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 
-	if (!strcmp(hba->vops->name, "intel-pci")) {
+	if (hba->vops && !strcmp(hba->vops->name, "intel-pci")) {
 		ufs_intel_resume_complete(dev);
 		return;
 	}
-- 
2.56.0.506.g506a7eabc5-goog


                 reply	other threads:[~2026-11-11  8:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261111084853.3530107-1-stanleyjhu@google.com \
    --to=stanleyjhu@google.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Rajeshkumar.Sambandham@amd.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=sangram.k.y@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®