PCI: of_property: Return error for int_map allocation failure
BugLink: https://bugs.launchpad.net/bugs/2073603
[ Upstream commit e6f7d27df5d208b50cae817a91d128fb434bb12c ]
Return -ENOMEM from of_pci_prop_intr_map() if kcalloc() fails to prevent a
NULL pointer dereference in this case.
Fixes: 407d1a5192 ("PCI: Create device tree node for bridge")
Link: https://lore.kernel.org/r/20240303105729.78624-1-duoming@zju.edu.cn
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Roxana Nicolescu
parent
cc1016f41c
commit
1abb846a9d
@@ -238,6 +238,8 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
|
||||
return 0;
|
||||
|
||||
int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL);
|
||||
if (!int_map)
|
||||
return -ENOMEM;
|
||||
mapp = int_map;
|
||||
|
||||
list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
|
||||
|
||||
Reference in New Issue
Block a user