PCI: of_property: Handle interrupt parsing failures
authorLizhi Hou <lizhi.hou@amd.com>
Fri, 29 Sep 2023 17:10:48 +0000 (10:10 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 29 Sep 2023 22:33:46 +0000 (17:33 -0500)
commit33efa29e825636a06d5711c9dfccf92726d2fc81
tree889344961aba955a640d9674564cb838697d17c2
parent6a878a54d0053ef21f3b829dc267487c2302b012
PCI: of_property: Handle interrupt parsing failures

of_pci_prop_intr_map() uses uninitialized addr_sz[] values if
of_irq_parse_raw() fails, which leads to intermittent crashes.

Clear addr_sz[] before use so we never use uninitialized elements.

If no valid IRQs are parsed, don't bother adding the interrupt-map
property.

Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Link: https://lore.kernel.org/r/1696007448-42127-1-git-send-email-lizhi.hou@amd.com
Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Closes: https://lore.kernel.org/all/20230911154856.000076c3@Huawei.com/
Reported-by: Herve Codina <herve.codina@bootlin.com>
Closes: https://lore.kernel.org/all/20230911171319.495bb837@bootlin.com/
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
[bhelgaas: commit log, add similar report from Herve]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
drivers/pci/of_property.c