net: eth-uclass: avoid running start() twice without stop()
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Wed, 4 Nov 2020 13:45:14 +0000 (14:45 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 19 Jan 2021 14:06:15 +0000 (09:06 -0500)
commitfa795f452541ce07b33be603de36cac3c5d7dfcf
tree7830e3f9612e2f2d2fa0e9e1c5d52e37a5257457
parentdb0dd72e27ce62c5b28f07595b91ed00d0565819
net: eth-uclass: avoid running start() twice without stop()

Running the start() handler twice without a stop() inbetween completely
breaks communication for some ethernet drivers like fec_mxc.

eth_halt() is called before each eth_init(). Due to the switch to
eth_is_active() in commit 68acb51f442f ("net: Only call halt on a driver
that has been init'ed"), this is not sufficient anymore when netconsole
is active: eth_init_state_only()/eth_halt_state_only() manipulate the
state check that is performed by eth_is_active() without actually
calling into the driver.

The issue can be triggered by starting a network operation (e.g. ping or
tftp) while netconsole is active.

Add an additional "running" flag that reflects the actual state of the
driver and use it to ensure that eth_halt() actually stops the device as
it is supposed to.

Fixes: 68acb51f442f ("net: Only call halt on a driver that has been init'ed")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
net/eth-uclass.c