android_kernel_motorola_sm6225/net/dsa
Dan Carpenter 0f2cb08c57 net: dsa: fix a crash if ->get_sset_count() fails
commit a269333fa5c0c8e53c92b5a28a6076a28cde3e83 upstream.

If ds->ops->get_sset_count() fails then it "count" is a negative error
code such as -EOPNOTSUPP.  Because "i" is an unsigned int, the negative
error code is type promoted to a very high value and the loop will
corrupt memory until the system crashes.

Fix this by checking for error codes and changing the type of "i" to
just int.

Fixes: badf3ada60 ("net: dsa: Provide CPU port statistics to master netdev")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 08:38:08 +02:00
..
dsa.c net: dsa: add GRO support via gro_cells 2021-03-11 14:05:00 +01:00
dsa2.c net: dsa: read mac address from DT for slave device 2020-11-10 12:36:02 +01:00
dsa_priv.h net: dsa: add GRO support via gro_cells 2021-03-11 14:05:00 +01:00
Kconfig net: dsa: add GRO support via gro_cells 2021-03-11 14:05:00 +01:00
legacy.c
Makefile
master.c net: dsa: fix a crash if ->get_sset_count() fails 2021-06-03 08:38:08 +02:00
port.c
slave.c net: dsa: add GRO support via gro_cells 2021-03-11 14:05:00 +01:00
switch.c
tag_brcm.c net: dsa: Fix duplicate frames flooded by learning 2020-04-02 15:28:11 +02:00
tag_dsa.c
tag_edsa.c dsa: Allow forwarding of redirected IGMP traffic 2020-09-23 12:10:56 +02:00
tag_ksz.c
tag_lan9303.c
tag_mtk.c net: dsa: tag_mtk: fix 802.1ad VLAN egress 2021-03-20 10:38:35 +01:00
tag_qca.c
tag_trailer.c