of/address: Fix NULL bus dereference in of_pci_range_parser_one()
authorCarlo Caione <ccaione@baylibre.com>
Mon, 27 Jul 2026 08:36:59 +0000 (10:36 +0200)
committerRob Herring (Arm) <robh@kernel.org>
Tue, 28 Jul 2026 15:34:37 +0000 (10:34 -0500)
commitbba13ad17b1a11b3f1ed9b3a5d556191d7755a59
tree5eaad320d900f44e28e197ea7fd70397fca73ba8
parentdb3dbdfea1b8f38774419c5c2c14e4b81c48708d
of/address: Fix NULL bus dereference in of_pci_range_parser_one()

The bus matching rework made of_match_bus() return NULL for nodes with
ranges/dma-ranges but no local #address-cells. parser_init() stored that
NULL bus, and the range iterator later dereferenced it.

Reject such nodes in parser_init(), leaving an explicit empty
iterator for callers that ignore the init return, and make
of_dma_get_max_cpu_address() honour the init failure so a rejected node
cannot clamp the DMA limit.

Fixes: 64ee3cf096ac ("of/address: Rework bus matching to avoid warnings")
Cc: stable@vger.kernel.org
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Link: https://patch.msgid.link/20260727-of-range-parser-null-bus-v3-1-be01b708a4ce@baylibre.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/address.c