summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Nemov <sergey.nemov@intel.com>2019-03-29 15:08:36 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-10 10:29:03 +0100
commit978c31f09d59cdd52cadc462f12862376e72f618 (patch)
tree24a699b64b2bd8fd0da1f8fb875b9ebc9f228d8c
parent09f34ad8629919192e429461f0145ddda65fada2 (diff)
downloadlinux-stable-978c31f09d59cdd52cadc462f12862376e72f618.tar.gz
linux-stable-978c31f09d59cdd52cadc462f12862376e72f618.tar.bz2
linux-stable-978c31f09d59cdd52cadc462f12862376e72f618.zip
i40e: add num_vectors checker in iwarp handler
commit 7015ca3df965378bcef072cca9cd63ed098665b5 upstream. Field num_vectors from struct virtchnl_iwarp_qvlist_info should not be larger than num_msix_vectors_vf in the hw struct. The iwarp uses the same set of vectors as the LAN VF driver. Signed-off-by: Sergey Nemov <sergey.nemov@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8d2f4e860767..4134b0d8810e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -419,6 +419,16 @@ static int i40e_config_iwarp_qvlist(struct i40e_vf *vf,
u32 next_q_idx, next_q_type;
u32 msix_vf, size;
+ msix_vf = pf->hw.func_caps.num_msix_vectors_vf;
+
+ if (qvlist_info->num_vectors > msix_vf) {
+ dev_warn(&pf->pdev->dev,
+ "Incorrect number of iwarp vectors %u. Maximum %u allowed.\n",
+ qvlist_info->num_vectors,
+ msix_vf);
+ goto err;
+ }
+
size = sizeof(struct virtchnl_iwarp_qvlist_info) +
(sizeof(struct virtchnl_iwarp_qv_info) *
(qvlist_info->num_vectors - 1));