diff options
author | Bo Chen <chenbo@pdx.edu> | 2018-07-23 12:01:29 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-08-24 11:52:35 -0400 |
commit | cf1acec008f8d7761aa3fd7c4bca7e17b2d2512d (patch) | |
tree | 3cbb7fec010ad6d8bedeffb3ecbccec1c3e7c70c | |
parent | a9910c0886470b659a6c3629d6467d5639c327e9 (diff) |
e1000: check on netif_running() before calling e1000_up()
When the device is not up, the call to 'e1000_up()' from the error handling path
of 'e1000_set_ringparam()' causes a kernel oops with a null-pointer
dereference. The null-pointer dereference is triggered in function
'e1000_alloc_rx_buffers()' at line 'buffer_info = &rx_ring->buffer_info[i]'.
This bug was reported by COD, a tool for testing kernel module binaries I am
building. This bug was also detected by KFI from Dr. Kai Cong.
This patch fixes the bug by checking on 'netif_running()' before calling
'e1000_up()' in 'e1000_set_ringparam()'.
Signed-off-by: Bo Chen <chenbo@pdx.edu>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index bdb3f8e65ed4..c1e4e94f100f 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -644,7 +644,8 @@ err_setup_rx: | |||
644 | err_alloc_rx: | 644 | err_alloc_rx: |
645 | kfree(txdr); | 645 | kfree(txdr); |
646 | err_alloc_tx: | 646 | err_alloc_tx: |
647 | e1000_up(adapter); | 647 | if (netif_running(adapter->netdev)) |
648 | e1000_up(adapter); | ||
648 | err_setup: | 649 | err_setup: |
649 | clear_bit(__E1000_RESETTING, &adapter->flags); | 650 | clear_bit(__E1000_RESETTING, &adapter->flags); |
650 | return err; | 651 | return err; |