]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI: keystone: Fix NULL pointer dereference in case of DT error in ks_pcie_setup_rc_a...
authorAleksandr Mishin <amishin@t-argos.ru>
Sun, 5 May 2024 06:15:17 +0000 (09:15 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 28 May 2024 16:15:15 +0000 (11:15 -0500)
commita231707a91f323af1e5d9f1722055ec2fc1c7775
tree008266f2eef874ca9eeaf1fc68348cb244cd71e1
parent9ffa0e70b2daf9b0271e4960b7c8a2350e2cda08
PCI: keystone: Fix NULL pointer dereference in case of DT error in ks_pcie_setup_rc_app_regs()

If IORESOURCE_MEM is not provided in Device Tree due to
any error, resource_list_first_type() will return NULL and
pci_parse_request_of_pci_ranges() will just emit a warning.

This will cause a NULL pointer dereference. Fix this bug by adding NULL
return check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0f71c60ffd26 ("PCI: dwc: Remove storing of PCI resources")
Link: https://lore.kernel.org/linux-pci/20240505061517.11527-1-amishin@t-argos.ru
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/dwc/pci-keystone.c