]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting
authorJisheng Zhang <Jisheng.Zhang@synaptics.com>
Fri, 3 Apr 2020 02:23:29 +0000 (10:23 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 29 Apr 2020 12:55:48 +0000 (14:55 +0200)
BugLink: https://bugs.launchpad.net/bugs/1873043
[ Upstream commit 3e1221acf6a8f8595b5ce354bab4327a69d54d18 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c

index 08dd6a06ac58d72727161c6526b7c2f7b02b3ab6..f76d4a7281af052d7dd140bb2aaf8d7df0e40f8b 100644 (file)
@@ -218,7 +218,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++;