Skip to contentSkip to conversation

FAILED: patch "[PATCH] device property: Fix fwnode_graph_devcon_match() fwnode leak" failed to apply to 5.4-stable tree

PATCH [email protected] 1 participant 1 message Jan 23, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 4a7f4110f79163fd53ea65438041994ed615e3af Mon Sep 17 00:00:00 2001
From: Sakari Ailus <[email protected]>
Date: Wed, 1 Dec 2021 14:59:29 +0200
Subject: [PATCH] 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 637e9e52b185 ("device connection: Find device connections also from device graphs")
Cc 5.1+ <[email protected]> # 5.1+
drivers/base/property.c +3 -1
index d0960a9e8974..b7b3a7b86006 100644
@@ -1158,8 +1158,10 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
 
 	fwnode_graph_for_each_endpoint(fwnode, ep) {
 		node = fwnode_graph_get_remote_port_parent(ep);
-		if (!fwnode_device_is_available(node))
+		if (!fwnode_device_is_available(node)) {
+			fwnode_handle_put(node);
 			continue;
+		}
 
 		ret = match(node, con_id, data);
 		fwnode_handle_put(node);