ice: add validation in OP_CONFIG_VSI_QUEUES VF message
authorMichal Swiatkowski <michal.swiatkowski@intel.com>
Thu, 25 Jul 2019 09:53:59 +0000 (02:53 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 27 Aug 2019 06:25:14 +0000 (23:25 -0700)
commit9c7dd7566d189426dd013edc3ddd00c1d981a8a0
treeb851f7f082ceb42e4851bbed212e6ed3def6ecfe
parente63a1dbdc7df4b6b48af920a86630c20a44340cf
ice: add validation in OP_CONFIG_VSI_QUEUES VF message

Check num_queue_pairs to avoid access to unallocated field of
vsi->tx_rings/vsi->rx_rings. Without this validation we can set
vsi->alloc_txq/vsi->alloc_rxq to value smaller than ICE_MAX_BASE_QS_PER_VF
and send this command with num_queue_pairs greater than
vsi->alloc_txq/vsi->alloc_rxq. This lead to access to unallocated memory.

In VF vsi alloc_txq and alloc_rxq should be the same. Get minimum
because looks more readable.

Also add validation for ring_len param. It should be greater than 32 and
be multiple of 32. Incorrect value leads to hang traffic on PF.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c