Skip to contentSkip to conversation

net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting

PATCH In review Jisheng Zhang 2 participants 2 messages Apr 3, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting

From: Jisheng Zhang <[email protected]>

Commit 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries") cleared the unused mac address entries, but introduced an out-of bounds mac address register programming bug -- After setting the secondary unicast mac addresses, the "reg" value has reached netdev_uc_count() + 1, thus we should only clear address entries if (addr < perfect_addr_number)

Fixes 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +1 -1
index 542784300620..efc6ec1b8027 100644
@@ -207,7 +207,7 @@ static void dwmac1000_set_filter(struct mac_device_info *hw,
 			reg++;
 		}
 
-		while (reg <= perfect_addr_number) {
+		while (reg < perfect_addr_number) {
 			writel(0, ioaddr + GMAC_ADDR_HIGH(reg));
 			writel(0, ioaddr + GMAC_ADDR_LOW(reg));
 			reg++;
Signature · 1 line
2.26.0
maintainer
#1 lore raw

From: Jisheng Zhang <[email protected]>
Date: Fri, 3 Apr 2020 10:23:29 +0800

Quoted 11 lines

From: Jisheng Zhang <[email protected]>

Commit 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries") cleared the unused mac address entries, but introduced an out-of bounds mac address register programming bug -- After setting the secondary unicast mac addresses, the "reg" value has reached netdev_uc_count() + 1, thus we should only clear address entries if (addr < perfect_addr_number)

Fixes 9463c4455900 ("net: stmmac: dwmac1000: Clear unused address entries")

Applied and queued up for -stable, thanks.