net: phy: marvell: Fix buffer overrun with stats counters
authorAndrew Lunn <andrew@lunn.ch>
Wed, 24 Apr 2019 22:33:00 +0000 (00:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 May 2019 12:42:38 +0000 (14:42 +0200)
commit1d412d873a12f5d7aa1d8ef1792f330a5e0a27c2
tree873a65c53a8f12debf8240945a1f9e098403bfd6
parentb48a0a1207e9033bbb16995a1a091f499710538e
net: phy: marvell: Fix buffer overrun with stats counters

[ Upstream commit fdfdf86720a34527f777cbe0d8599bf0528fa146 ]

marvell_get_sset_count() returns how many statistics counters there
are. If the PHY supports fibre, there are 3, otherwise two.

marvell_get_strings() does not make this distinction, and always
returns 3 strings. This then often results in writing past the end
of the buffer for the strings.

Fixes: 2170fef78a40 ("Marvell phy: add field to get errors from fiber link.")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-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>
drivers/net/phy/marvell.c