device property: Fix fwnode_graph_devcon_match() fwnode leak
authorSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 1 Dec 2021 12:59:29 +0000 (14:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:10 +0000 (11:05 +0100)
commitb8902d5ab431f9ac9a3a787e527bc2ec10e4d02a
tree5521eb38a606d8a6e55a085ebfd7243dfd534b26
parent9d28671017047af1ca14d00c946f02e0fd871ff4
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>
drivers/base/property.c