Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf1acec0 authored by Bo Chen's avatar Bo Chen Committed by Jeff Kirsher
Browse files

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: default avatarBo Chen <chenbo@pdx.edu>
Acked-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent a9910c08
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -644,6 +644,7 @@ static int e1000_set_ringparam(struct net_device *netdev,
err_alloc_rx:
err_alloc_rx:
	kfree(txdr);
	kfree(txdr);
err_alloc_tx:
err_alloc_tx:
	if (netif_running(adapter->netdev))
		e1000_up(adapter);
		e1000_up(adapter);
err_setup:
err_setup:
	clear_bit(__E1000_RESETTING, &adapter->flags);
	clear_bit(__E1000_RESETTING, &adapter->flags);