]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: marvell10g: fix null pointer dereference
authorMarek Behún <marek.behun@nic.cz>
Mon, 10 Aug 2020 15:01:58 +0000 (17:01 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Aug 2020 22:42:23 +0000 (15:42 -0700)
commit1a0912562e5c7e0a15f2d793fe6f5cbae33987be
tree908ef02a628774a5239d1bc11c092c5b85e77e72
parenta9197cca4e3740b2b8e5ddd2d4756d65bd3f7c13
net: phy: marvell10g: fix null pointer dereference

Commit e29569f1413e ("net: phy: marvell10g: fix temperature sensor on 2110")
added a check for PHY ID via phydev->drv->phy_id in a function which is
called by devres at a time when phydev->drv is already set to null by
phy_remove function.

This null pointer dereference can be triggered via SFP subsystem with a
SFP module containing this Marvell PHY. When the SFP interface is put
down, the SFP subsystem removes the PHY.

Fixes: e29569f1413e ("net: phy: marvell10g: fix temperature sensor on 2110")
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/marvell10g.c