lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250830091854.2111062-1-linmq006@gmail.com>
Date: Sat, 30 Aug 2025 17:18:54 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Marcin Wojtas <marcin.s.wojtas@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: linmq006@...il.com
Subject: [PATCH] net: mvpp2: Fix refcount leak in mvpp2_use_acpi_compat_mode

The function calls fwnode_get_named_child_node()
to check for a "fixed-link" child.
It did not release the reference if present, causing a refcount leak.

Fixes: dfce1bab8fdc ("net: mvpp2: enable using phylink with ACPI")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 8ebb985d2573..1faed2ec3f4f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6801,12 +6801,22 @@ static void mvpp2_acpi_start(struct mvpp2_port *port)
  */
 static bool mvpp2_use_acpi_compat_mode(struct fwnode_handle *port_fwnode)
 {
+	struct fwnode_handle *fixed_link;
+
 	if (!is_acpi_node(port_fwnode))
 		return false;
 
-	return (!fwnode_property_present(port_fwnode, "phy-handle") &&
-		!fwnode_property_present(port_fwnode, "managed") &&
-		!fwnode_get_named_child_node(port_fwnode, "fixed-link"));
+	if (fwnode_property_present(port_fwnode, "phy-handle") ||
+	    fwnode_property_present(port_fwnode, "managed"))
+		return false;
+
+	fixed_link = fwnode_get_named_child_node(port_fwnode, "fixed-link");
+	if (fixed_link) {
+		fwnode_handle_put(fixed_link);
+		return false;
+	}
+
+	return true;
 }
 
 /* Ports initialization */
-- 
2.35.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ