net: phy: marvell: Fix buffer overrun with stats counters
commitd0558dfcd0425cf1e7ed2fdf825681aec75fd96b
authorAndrew Lunn <andrew@lunn.ch>
Wed, 24 Apr 2019 22:33:00 +0000 (25 00:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:19:05 +0000 (8 07:19 +0200)
tree4a2d5deac07bfe515c90d21ce970776a21f5373e
parent4c3215b53cc901881be27faedcc5734d3a391c09
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