RE: [PATCH net] driver: e1000: fix race condition between e1000_down() and e1000_watchdog

From: Brown, Aaron F
Date: Tue Oct 10 2017 - 21:07:56 EST


> From: netdev-owner@xxxxxxxxxxxxxxx [mailto:netdev-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Vincenzo Maffione
> Sent: Saturday, September 16, 2017 9:00 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@xxxxxxxxx>
> Cc: intel-wired-lan@xxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Vincenzo Maffione <v.maffione@xxxxxxxxx>
> Subject: [PATCH net] driver: e1000: fix race condition between e1000_down()
> and e1000_watchdog
>
> This patch fixes a race condition that can result into the interface being
> up and carrier on, but with transmits disabled in the hardware.
> The bug may show up by repeatedly IFF_DOWN+IFF_UP the interface, which
> allows e1000_watchdog() interleave with e1000_down().
>
> CPU x CPU y
> --------------------------------------------------------------------
> e1000_down():
> netif_carrier_off()
> e1000_watchdog():
> if (carrier == off) {
> netif_carrier_on();
> enable_hw_transmit();
> }
> disable_hw_transmit();
> e1000_watchdog():
> /* carrier on, do nothing */
>
> Signed-off-by: Vincenzo Maffione <v.maffione@xxxxxxxxx>
> ---
> drivers/net/ethernet/intel/e1000/e1000_main.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)

Tested-by: Aaron Brown <aaron.f.brown@xxxxxxxxx>