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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 14 Oct 2020 23:04:34 +0100
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Lukasz Stelmach <l.stelmach@...sung.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Bartłomiej Żolnierkiewicz 
        <b.zolnierkie@...sung.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH] net: phy: Prevent reporting advertised modes when
 autoneg is off

On Wed, Oct 14, 2020 at 04:39:47PM +0200, Lukasz Stelmach wrote:
> It was <2020-10-14 śro 14:32>, when Russell King - ARM Linux admin wrote:
> > In any case, the mii.c code does fill in the advertising mask even
> > when autoneg is disabled, because, rightly or wrongly, the advertising
> > mask contains more than just the link modes, it includes the
> > interface(s) as well. Your change means phylib no longer reports the
> > interface modes which is at odds with the mii.c code.
> 
> I am afraid you are wrong. There is a rather big if()[1], which
> depending on AN beeing enabled fills more or less information. Yes this
> if() looks like it has been yanked from mii_ethtool_gset(). When
> advertising is converted and copied to cmd->link_modes.advertising at
> the end of mii_ethtool_get_link_ksettings() it is 0[2] if autonegotiation
> is disabled.
> 
> [1] https://elixir.bootlin.com/linux/v5.9/source/drivers/net/mii.c#L174
> [2] https://elixir.bootlin.com/linux/v5.9/source/drivers/net/mii.c#L215

I'm very sorry, but I have to disagree.  I'll quote the code here:

        advertising = ADVERTISED_TP | ADVERTISED_MII;

	// This is your big if()
        if (bmcr & BMCR_ANENABLE) {
		advertising |= ADVERTISED_Autoneg;
		...
	} else {
		...
	}

	ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
	                                        advertising);

So, when AN is disabled, we still end up with TP and MII in the
advertised link modes. I call TP and MII "interface modes" above
to separate them from the "link modes" that describe the speed and
duplex etc.

Note that only lp_advertising is zeroed in the "else" clause of
the above "if" statement - advertising remains as-is with TP and MII
set.

Your patch, on the other hand, merely avoids setting anything in
cmd->link_modes.advertising, which means we do not end up with the
"interface modes".

I hope that this helps you see my point.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ