From: Miaoqian Lin <linmq006@gmail.com>
To: Marcin Wojtas <marcin.s.wojtas@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com
Subject: [PATCH] net: mvpp2: Fix refcount leak in mvpp2_use_acpi_compat_mode
Date: Sat, 30 Aug 2025 17:18:54 +0800 [thread overview]
Message-ID: <20250830091854.2111062-1-linmq006@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2025-08-30 9:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 9:18 Miaoqian Lin [this message]
2025-09-01 15:00 ` [PATCH] net: mvpp2: Fix refcount leak in mvpp2_use_acpi_compat_mode Simon Horman
2025-09-01 19:50 ` Jakub Kicinski
2025-09-02 14:09 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250830091854.2111062-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marcin.s.wojtas@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).