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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260130040011.707782-1-kuba@kernel.org>
Date: Thu, 29 Jan 2026 20:00:11 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: maxime.chevallier@...tlin.com
Cc: Jakub Kicinski <kuba@...nel.org>,
	daniel@...rotopia.org,
	christophe.leroy@...roup.eu,
	kabel@...nel.org,
	kory.maincent@...tlin.com,
	f.fainelli@...il.com,
	vladimir.oltean@....com,
	netdev@...r.kernel.org,
	horms@...nel.org,
	mwojtas@...omium.org,
	o.rempel@...gutronix.de,
	romain.gantois@...tlin.com,
	herve.codina@...tlin.com,
	dimitri.fedrau@...bherr.com,
	hkallweit1@...il.com,
	nicveronese@...il.com,
	linux-kernel@...r.kernel.org,
	edumazet@...gle.com,
	pabeni@...hat.com,
	thomas.petazzoni@...tlin.com,
	andrew@...n.ch,
	davem@...emloft.net,
	linux@...linux.org.uk
Subject: Re: [net-next,v2,03/12] net: phy: phy_link_topology: Track ports in phy_link_topology

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
    net: phy: phy_link_topology: Track ports in phy_link_topology

This commit adds a new ports xarray to phy_link_topology to track
phy_port structures alongside PHY devices. The ports are added when
a PHY is added and removed when a PHY is removed.

> diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_link_topology.c
> index 7dc2ff10c74a..456f1144e83e 100644
> --- a/drivers/net/phy/phy_link_topology.c
> +++ b/drivers/net/phy/phy_link_topology.c

[ ... ]

> @@ -22,6 +23,9 @@ static int netdev_alloc_phy_link_topology(struct net_device *dev)
> 	xa_init_flags(&topo->phys, XA_FLAGS_ALLOC1);
> 	topo->next_phy_index = 1;
>
> +	xa_init_flags(&topo->ports, XA_FLAGS_ALLOC1);
> +	topo->next_port_index = 1;
> +
> 	dev->link_topo = topo;
>
> 	return 0;

The ports xarray is initialized here, but netdev_free_phy_link_topology()
in net/core/dev.c only calls xa_destroy() on topo->phys:

    static void netdev_free_phy_link_topology(struct net_device *dev)
    {
        struct phy_link_topology *topo = dev->link_topo;

        if (IS_ENABLED(CONFIG_PHYLIB) && topo) {
            xa_destroy(&topo->phys);
            kfree(topo);
            dev->link_topo = NULL;
        }
    }

Should xa_destroy(&topo->ports) be added before the kfree(topo) to avoid
leaking memory allocated by the ports xarray?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ