Patch "x86/PCI: Check pcie_find_root_port() return for NULL" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/PCI: Check pcie_find_root_port() return for NULL

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-pci-check-pcie_find_root_port-return-for-null.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit aaf5caf66451a1f17e0c3b3546263222db7c9194
Author: Samasth Norway Ananda <samasth.norway.ananda@xxxxxxxxxx>
Date:   Mon Aug 12 13:26:59 2024 -0700

    x86/PCI: Check pcie_find_root_port() return for NULL
    
    [ Upstream commit dbc3171194403d0d40e4bdeae666f6e76e428b53 ]
    
    If pcie_find_root_port() is unable to locate a Root Port, it will return
    NULL. Check the pointer for NULL before dereferencing it.
    
    This particular case is in a quirk for devices that are always below a Root
    Port, so this won't avoid a problem and doesn't need to be backported, but
    check as a matter of style and to prevent copy/paste mistakes.
    
    Link: https://lore.kernel.org/r/20240812202659.1649121-1-samasth.norway.ananda@xxxxxxxxxx
    Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@xxxxxxxxxx>
    [bhelgaas: drop Fixes: and explain why there's no problem in this case]
    Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
    Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index b33afb240601b..98a9bb92d75c8 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -980,7 +980,7 @@ static void amd_rp_pme_suspend(struct pci_dev *dev)
 		return;
 
 	rp = pcie_find_root_port(dev);
-	if (!rp->pm_cap)
+	if (!rp || !rp->pm_cap)
 		return;
 
 	rp->pme_support &= ~((PCI_PM_CAP_PME_D3hot|PCI_PM_CAP_PME_D3cold) >>
@@ -994,7 +994,7 @@ static void amd_rp_pme_resume(struct pci_dev *dev)
 	u16 pmc;
 
 	rp = pcie_find_root_port(dev);
-	if (!rp->pm_cap)
+	if (!rp || !rp->pm_cap)
 		return;
 
 	pci_read_config_word(rp, rp->pm_cap + PCI_PM_PMC, &pmc);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux