Supplier bindings can map a property node to the device node which consumes the referenced resource. The remote-endpoint binding uses of_graph_get_port_parent(), which can return NULL for a malformed graph node without its expected parents. of_link_property() currently passes that NULL node through to fwnode_link_add(), which dereferences the consumer while adding the link. Only create the link when the binding resolved a consumer node. A malformed graph property then creates no dependency instead of crashing while fw_devlink parses the tree. Fixes: f7514a663016 ("of: property: fw_devlink: Add support for remote-endpoint") Signed-off-by: James Hilliard --- drivers/of/property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 72cf12907de0..38c0c7dc428a 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1620,7 +1620,9 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) matched = true; i++; - of_link_to_phandle(con_dev_np, phandle, s->fwlink_flags); + if (con_dev_np) + of_link_to_phandle(con_dev_np, phandle, + s->fwlink_flags); of_node_put(phandle); } s++; -- 2.53.0