]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/PCI: Check pcie_find_root_port() return for NULL
authorSamasth Norway Ananda <samasth.norway.ananda@oracle.com>
Mon, 12 Aug 2024 20:26:59 +0000 (13:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:06 +0000 (16:33 +0200)
commita6fb2bf1e747ab0213807619cee880c7b98d8346
tree00d9841e87ddfa357b9613fee6d63d0f18bbcf03
parent660c4de1777ea6614b5da6a2ba89d9c6a0ac5bd0
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@oracle.com
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
[bhelgaas: drop Fixes: and explain why there's no problem in this case]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/pci/fixup.c