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-next>] [day] [month] [year] [list]
Date:   Wed, 22 Feb 2023 04:17:38 +0100
From:   Marek Vasut <marex@...x.de>
To:     netdev@...r.kernel.org
Cc:     Marek Vasut <marex@...x.de>,
        "David S. Miller" <davem@...emloft.net>,
        Andrew Lunn <andrew@...n.ch>,
        Arun Ramadoss <arun.ramadoss@...rochip.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Russell King <linux@...linux.org.uk>,
        UNGLinuxDriver@...rochip.com, Vladimir Oltean <olteanv@...il.com>,
        Woojung Huh <woojung.huh@...rochip.com>, stable@...r.kernel.org
Subject: [PATCH] net: dsa: microchip: Fix gigabit set and get function for KSZ87xx

Per KSZ8794 [1] datasheet DS00002134D page 54 TABLE 4-4: PORT REGISTERS,
it is Register 86 (0x56): Port 4 Interface Control 6 which contains the
Is_1Gbps field.

Currently, the driver uses PORT read function on register P_XMII_CTRL_1
to access the P_GMII_1GBIT_M, i.e. Is_1Gbps, bit. The problem is, the
register P_XMII_CTRL_1 address is already 0x56, which is the converted
PORT register address instead of the offset within PORT register space
that PORT read function expects and converts into the PORT register
address internally. The incorrectly double-converted register address
becomes 0xa6, which is what the PORT read function ultimatelly accesses,
and which is a non-existent register on the KSZ8794/KSZ8795 .

The correct value for P_XMII_CTRL_1 is 0x6, which gets converted into
port address 0x56, which is Register 86 (0x56): Port 4 Interface Control 6
per KSZ8794 datasheet, i.e. the correct register address.

To make this worse, there are multiple other call sites which read and
even write the P_XMII_CTRL_1 register, one of them is ksz_set_xmii(),
which is responsible for configuration of RGMII delays. These delays
are incorrectly configured and a non-existent register is written
without this change.

Fix the P_XMII_CTRL_1 register offset to resolve these problems.

[1] https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8794CNX-Data-Sheet-DS00002134.pdf

Fixes: 46f80fa8981b ("net: dsa: microchip: add common gigabit set and get function")
Signed-off-by: Marek Vasut <marex@...x.de>
---
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Arun Ramadoss <arun.ramadoss@...rochip.com>
Cc: David S. Miller <davem@...emloft.net>
Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Florian Fainelli <f.fainelli@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>
Cc: Russell King <linux@...linux.org.uk>
Cc: UNGLinuxDriver@...rochip.com
Cc: Vladimir Oltean <olteanv@...il.com>
Cc: Woojung Huh <woojung.huh@...rochip.com>
Cc: stable@...r.kernel.org
Cc: netdev@...r.kernel.org
---
 drivers/net/dsa/microchip/ksz_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 729b36eeb2c46..7fc2155d93d6e 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -319,7 +319,7 @@ static const u16 ksz8795_regs[] = {
 	[S_BROADCAST_CTRL]		= 0x06,
 	[S_MULTICAST_CTRL]		= 0x04,
 	[P_XMII_CTRL_0]			= 0x06,
-	[P_XMII_CTRL_1]			= 0x56,
+	[P_XMII_CTRL_1]			= 0x06,
 };
 
 static const u32 ksz8795_masks[] = {
-- 
2.39.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ