Skip to content

Commit 4a7f411

Browse files
Sakari Ailusrafaeljw
authored andcommitted
device property: Fix fwnode_graph_devcon_match() fwnode leak
For each endpoint it encounters, fwnode_graph_devcon_match() checks whether the endpoint's remote port parent device is available. If it is not, it ignores the endpoint but does not put the reference to the remote endpoint port parent fwnode. For available devices the fwnode handle reference is put as expected. Put the reference for unavailable devices now. Fixes: 637e9e5 ("device connection: Find device connections also from device graphs") Cc: 5.1+ <[email protected]> # 5.1+ Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2338e7b commit 4a7f411

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/base/property.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,10 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
11581158

11591159
fwnode_graph_for_each_endpoint(fwnode, ep) {
11601160
node = fwnode_graph_get_remote_port_parent(ep);
1161-
if (!fwnode_device_is_available(node))
1161+
if (!fwnode_device_is_available(node)) {
1162+
fwnode_handle_put(node);
11621163
continue;
1164+
}
11631165

11641166
ret = match(node, con_id, data);
11651167
fwnode_handle_put(node);

0 commit comments

Comments
 (0)