linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting
@ 2020-04-03  2:23 Jisheng Zhang
  2020-04-03 22:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2020-04-03  2:23 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, David S. Miller
  Cc: netdev, linux-arm-kernel, linux-kernel

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

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")
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 542784300620..efc6ec1b8027 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -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++;
-- 
2.26.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting
  2020-04-03  2:23 [PATCH] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting Jisheng Zhang
@ 2020-04-03 22:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-03 22:59 UTC (permalink / raw)
  To: jszhang3
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, netdev,
	linux-arm-kernel, linux-kernel

From: Jisheng Zhang <jszhang3@mail.ustc.edu.cn>
Date: Fri, 3 Apr 2020 10:23:29 +0800

> From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> 
> 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")
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-03 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03  2:23 [PATCH] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting Jisheng Zhang
2020-04-03 22:59 ` David Miller

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).