linux/drivers/net/ethernet/intel
John Fastabend 51f3773bde ixgbe: deleting dfwd stations out of order can cause null ptr deref
The number of stations in use is kept in the num_rx_pools counter
in the ixgbe_adapter structure. This is in turn used by the queue
allocation scheme to determine how many queues are needed to support
the number of pools in use with the current feature set.

This works as long as the pools are added and destroyed in order
because (num_rx_pools * queues_per_pool) is equal to the last
queue in use by a pool. But as soon as you delete a pool out of
order this is no longer the case. So the above multiplication
allocates to few queues and a pool may reference a ring that has
not been allocated/initialized.

To resolve use the bit mask of in use pools to determine the final
pool being used and allocate enough queues so that we don't
inadvertently remove its queues.

# ip link add link eth2 \
	numtxqueues 4 numrxqueues 4 txqueuelen 50 type macvlan
# ip link set dev macvlan0 up
# ip link add link eth2 \
	numtxqueues 4 numrxqueues 4 txqueuelen 50 type macvlan
# ip link set dev macvlan1 up
# for i in {0..100}; do
  ip link set dev macvlan0 down; ip link set dev macvlan0 up;
  done;

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-08 15:21:08 -05:00
..
e1000 e1000: fix wrong queue idx calculation 2013-11-01 05:45:29 -07:00
e1000e intel: Remove extern from function prototypes 2013-09-24 12:51:37 -07:00
i40e i40e: fix error return code in i40e_probe() 2013-10-29 04:29:25 -07:00
igb igb: Don't let ethtool try to write to iNVM in i210/i211 2013-11-01 06:04:52 -07:00
igbvf igbvf: add missing iounmap() on error in igbvf_probe() 2013-10-24 05:11:16 -07:00
ixgb intel: Remove extern from function prototypes 2013-09-24 12:51:37 -07:00
ixgbe ixgbe: deleting dfwd stations out of order can cause null ptr deref 2013-11-08 15:21:08 -05:00
ixgbevf ixgbe: cleanup IXGBE_DESC_UNUSED 2013-11-01 06:20:10 -07:00
e100.c net: e100: remove unnecessary pci_set_drvdata() 2013-10-21 17:21:01 -04:00
Kconfig i40e: include i40e in kernel proper 2013-09-11 02:28:40 -07:00
Makefile i40e: include i40e in kernel proper 2013-09-11 02:28:40 -07:00