]> www.infradead.org Git - users/jedix/linux-maple.git/commit
e1000: fix race condition between e1000_down() and e1000_watchdog
authorVincenzo Maffione <v.maffione@gmail.com>
Sat, 16 Sep 2017 16:00:00 +0000 (18:00 +0200)
committerJack Vogel <jack.vogel@oracle.com>
Mon, 8 Jan 2018 17:48:18 +0000 (09:48 -0800)
commit0f5288704a2e255e6e4f6fa7b2eb881a88f5270e
tree56abfcdc43cab8ae282c8aaba4fc7d6466c23647
parentafc8c11862a159fdac792411b802dfb3e09040d4
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@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 27069012
(cherry picked from commit 44c445c3d1b4eacff23141fa7977c3b2ec3a45c9)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/net/ethernet/intel/e1000/e1000_main.c