WSL2-Linux-Kernel/drivers/net/phy
Heiner Kallweit a200490717 net: phy: fix potential race in the phylib state machine
Russell reported the following race in the phylib state machine
(quoting from his mail):

if (phy_polling_mode(phydev) && phy_is_started(phydev))
	phy_queue_state_machine(phydev, PHY_STATE_TIME);

state = PHY_UP
thread 0			thread 1
				phy_disconnect()
				+-phy_is_started()
phy_is_started()                |
				`-phy_stop()
				  +-phydev->state = PHY_HALTED
				  `-phy_stop_machine()
				    `-cancel_delayed_work_sync()
phy_queue_state_machine()
`-mod_delayed_work()

At this point, the phydev->state_queue() has been added back onto the
system workqueue despite phy_stop_machine() having been called and
cancel_delayed_work_sync() called on it.

Fix this by protecting the complete operation in thread 0.

Fixes: 2b3e88ea65 ("net: phy: improve phy state checking")
Reported-by: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-02-14 12:04:55 -05:00
..
Kconfig net: phy: bcm63xx: Allow to be built with COMPILE_TEST 2018-09-12 20:24:20 -07:00
Makefile net: phy: mscc-miim: Add MDIO driver 2018-05-15 16:41:15 -04:00
amd.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
aquantia.c net: ethernet: Convert phydev advertize and supported from u32 to link mode 2018-11-11 10:10:01 -08:00
asix.c net: phy: Fixup GPLv2+ SPDX tags based on license text 2019-01-22 20:57:03 -08:00
at803x.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
bcm-cygnus.c net: phy: broadcom: Fix bcm_write_exp() 2018-05-23 15:27:01 -04:00
bcm-phy-lib.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-05-26 19:46:15 -04:00
bcm-phy-lib.h net: phy: broadcom: Fix bcm_write_exp() 2018-05-23 15:27:01 -04:00
bcm7xxx.c net: phy: bcm7xxx: Add entry for BCM7255 2018-11-07 21:50:27 -08:00
bcm63xx.c net: ethernet: Convert phydev advertize and supported from u32 to link mode 2018-11-11 10:10:01 -08:00
bcm87xx.c net: phy: Add missing features to PHY drivers 2019-01-16 15:41:02 -08:00
broadcom.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-11-11 17:57:54 -08:00
cicada.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
cortina.c net: phy: add missing phy driver features 2019-01-17 22:03:25 -08:00
davicom.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
dp83tc811.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
dp83640.c net: dp83640: expire old TX-skb 2019-02-04 08:54:52 -08:00
dp83640_reg.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dp83822.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
dp83848.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
dp83867.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
et1011c.c net: phy: et011c: Remove incorrect PHY_POLL flags 2018-09-16 15:31:01 -07:00
fixed_phy.c Fixed PHY: Add fixed_phy_change_carrier() 2018-12-17 11:24:32 -08:00
icplus.c net: phy: icplus: allow configuring the interrupt function on IP101GR 2018-11-18 16:16:20 -08:00
intel-xway.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
lxt.c net: phy: Convert u32 phydev->lp_advertising to linkmode 2018-11-11 10:10:01 -08:00
marvell.c Revert "net: phy: marvell: avoid pause mode on SGMII-to-Copper for 88e151x" 2019-02-02 19:43:23 -08:00
marvell10g.c net: mii: Rename mii_stat1000_to_linkmode_lpa_t 2018-12-05 16:26:16 -08:00
mdio-bcm-iproc.c net: phy: Initialize mdio clock at probe function 2017-02-09 17:10:23 -05:00
mdio-bcm-unimac.c net: phy: mdio-bcm-unimac: mark PM functions as __maybe_unused 2018-09-28 10:25:11 -07:00
mdio-bitbang.c net: phy: mdio-bitbang: Remove reset support 2018-04-19 15:59:10 -04:00
mdio-boardinfo.c net: phy: mdio-boardinfo: Allow recursive mdiobus_register() 2018-04-20 10:33:26 -04:00
mdio-boardinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mdio-cavium.c
mdio-cavium.h
mdio-gpio.c net: phy: mdio-gpio: Add phy_ignore_ta_mask to platform data 2018-12-08 21:33:30 -08:00
mdio-hisi-femac.c net: phy: Fixup GPLv2+ SPDX tags based on license text 2019-01-22 20:57:03 -08:00
mdio-i2c.c net: phy: add I2C mdio bus 2017-08-06 20:55:28 -07:00
mdio-i2c.h net: phy: add I2C mdio bus 2017-08-06 20:55:28 -07:00
mdio-moxart.c
mdio-mscc-miim.c drivers: net: Remove device_node checks with of_mdiobus_register() 2018-05-16 14:20:36 -04:00
mdio-mux-bcm-iproc.c net: phy: mdio-mux-bcm-iproc: simplify getting .driver_data 2018-10-21 21:10:12 -07:00
mdio-mux-gpio.c gpiolib: Pass array info to get/set array functions 2018-09-13 11:16:54 +02:00
mdio-mux-mmioreg.c net: phy: mdio-mux: slience probe defer error 2018-03-07 12:39:59 -05:00
mdio-mux.c net: mdio-mux: add mdio_mux parameter to mdio_mux_init() 2017-09-05 14:42:52 -07:00
mdio-octeon.c
mdio-sun4i.c mdio-sun4i: Fix a memory leak 2018-01-08 14:30:28 -05:00
mdio-thunder.c net: phy: Convert to using %pOFn instead of device_node.name 2018-10-01 23:29:37 -07:00
mdio-xgene.c net: phy: xgene: disable clk on error paths 2017-12-18 15:09:42 -05:00
mdio-xgene.h drivers: net: phy: xgene: Add lock to protect mac access 2017-05-16 11:41:08 -04:00
mdio_bus.c net: phy: mdio_bus: add missing device_del() in mdiobus_register() error handling 2019-01-18 11:07:33 -08:00
mdio_device.c phylib: rename reset-(post-)delay-us to reset-(de)assert-us 2017-12-27 11:06:50 -05:00
meson-gxl.c net: phy: meson-gxl: Use the genphy_soft_reset callback 2019-01-15 22:27:34 -08:00
micrel.c net: phy: Add missing features to PHY drivers 2019-01-16 15:41:02 -08:00
microchip.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
microchip_t1.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
mscc.c net: phy: mscc: Fix the VSC 8531/41 Chip Init sequence 2018-12-19 10:33:25 -08:00
national.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
phy-c45.c net: phy: Convert u32 phydev->lp_advertising to linkmode 2018-11-11 10:10:01 -08:00
phy-core.c net: phy: Add support for resolving 5G and 2.5G autoneg 2018-11-11 10:10:02 -08:00
phy.c net: phy: fix potential race in the phylib state machine 2019-02-14 12:04:55 -05:00
phy_device.c net: phy: phy driver features are mandatory 2019-01-19 10:03:08 -08:00
phy_led_triggers.c net: phy: leds: Don't make our own link speed names 2018-11-09 20:13:51 -08:00
phylink.c net: phylink: avoid resolving link state too early 2019-02-12 12:25:18 -05:00
qsemi.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
realtek.c net: phy: realtek: use new PHYID matching macros 2018-11-11 09:44:14 -08:00
rockchip.c net: phy: Fixup GPLv2+ SPDX tags based on license text 2019-01-22 20:57:03 -08:00
sfp-bus.c net: sfp: do not probe SFP module before we're attached 2019-02-08 15:11:25 -08:00
sfp.c net: sfp: do not probe SFP module before we're attached 2019-02-08 15:11:25 -08:00
sfp.h net: sfp: do not probe SFP module before we're attached 2019-02-08 15:11:25 -08:00
smsc.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
spi_ks8995.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
ste10Xp.c net: phy: remove flag PHY_HAS_INTERRUPT from driver configs 2018-11-11 09:36:56 -08:00
swphy.c phy: generate swphy registers on the fly 2016-06-27 10:40:57 -04:00
swphy.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
teranetics.c net: phy: add missing phy driver features 2019-01-17 22:03:25 -08:00
uPD60620.c net: phy: Convert u32 phydev->lp_advertising to linkmode 2018-11-11 10:10:01 -08:00
vitesse.c net: phy: vitesse: remove duplicate support for VSC8574 2018-11-23 17:25:32 -08:00
xilinx_gmii2rgmii.c net: phy: xgmiitorgmii: Check read_status results 2018-06-28 16:12:06 +09:00