* [PATCH] scsi: ufs: ufs-pci: Check hba->vops in system PM callbacks
@ 2026-11-11 8:48 Stanley Jhu
2026-11-14 5:37 ` Adrian Hunter
0 siblings, 1 reply; 2+ messages in thread
From: Stanley Jhu @ 2026-11-11 8:48 UTC (permalink / raw)
To: Martin K . Petersen, James E . J . Bottomley
Cc: Adrian Hunter, Alim Akhtar, Bart Van Assche, Bean Huo,
sangram kumar yerra, Rajeshkumar Sambandham, Stanley Jhu,
linux-scsi, linux-kernel, stable
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: ufs: ufs-pci: Check hba->vops in system PM callbacks
2026-11-11 8:48 [PATCH] scsi: ufs: ufs-pci: Check hba->vops in system PM callbacks Stanley Jhu
@ 2026-11-14 5:37 ` Adrian Hunter
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2026-11-14 5:37 UTC (permalink / raw)
To: Stanley Jhu, Martin K . Petersen, James E . J . Bottomley
Cc: Alim Akhtar, Bart Van Assche, Bean Huo, sangram kumar yerra,
Rajeshkumar Sambandham, linux-scsi, linux-kernel, stable
On 11/11/2026 10:48, Stanley Jhu wrote:
> 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>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-14 5:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 8:48 [PATCH] scsi: ufs: ufs-pci: Check hba->vops in system PM callbacks Stanley Jhu
2026-11-14 5:37 ` Adrian Hunter
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®