diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2021-09-16 14:33:35 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-22 12:28:07 +0200 |
commit | a23d3576215f7447c547976817b33cb975ecec84 (patch) | |
tree | 30d01d454c45be34fc8c9430cf75ff7d88fcafd6 /arch/arm/mm/cache-feroceon-l2.c | |
parent | 9f2972e151dd16d3286c1407bec4e66395f30135 (diff) | |
download | linux-stable-a23d3576215f7447c547976817b33cb975ecec84.tar.gz linux-stable-a23d3576215f7447c547976817b33cb975ecec84.tar.bz2 linux-stable-a23d3576215f7447c547976817b33cb975ecec84.zip |
net: dsa: bcm_sf2: Fix array overrun in bcm_sf2_num_active_ports()
commit 02319bf15acf54004216e40ac9c171437f24be24 upstream.
After d12e1c464988 ("net: dsa: b53: Set correct number of ports in the
DSA struct") we stopped setting dsa_switch::num_ports to DSA_MAX_PORTS,
which created an off by one error between the statically allocated
bcm_sf2_priv::port_sts array (of size DSA_MAX_PORTS). When
dsa_is_cpu_port() is used, we end-up accessing an out of bounds member
and causing a NPD.
Fix this by iterating with the appropriate port count using
ds->num_ports.
Fixes: d12e1c464988 ("net: dsa: b53: Set correct number of ports in the DSA struct")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm/mm/cache-feroceon-l2.c')
0 files changed, 0 insertions, 0 deletions