summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2021-12-01 15:59:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 12:54:25 +0300
commit6c1e3d8b1bff4c861c9ebe2d37a5b296fc7ee207 (patch)
tree5bd4099ee04abb8344912759f028c59a0b1479df /drivers/base
parentecb71f7bd584cd56713b139b6429a8ddaef30f7b (diff)
downloadlinux-6c1e3d8b1bff4c861c9ebe2d37a5b296fc7ee207.tar.xz
device property: Fix fwnode_graph_devcon_match() fwnode leak
commit 4a7f4110f79163fd53ea65438041994ed615e3af upstream. 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+ <stable@vger.kernel.org> # 5.1+ Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/property.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 4c43d30145c6..cf88a5554d9c 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1195,8 +1195,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);