diff mbox

[next-queue,S2,02/15] i40e: validate VSI param from VFs

Message ID 1427257825-24519-2-git-send-email-jeffrey.t.kirsher@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Kirsher, Jeffrey T March 25, 2015, 4:30 a.m. UTC
From: Mitch Williams <mitch.a.williams@intel.com>

Validate that the VF has sent us a valid VSI index before actually using
that index. Without this code, a malicious or buggy VF driver could
panic the host by sending an invalid index into the VSI array.

Change-ID: I66a177687a0dcc281ec83e714d3813d70d18c8b4
Reported-by: Nick Nunley <nicholas.d.nunley@intel.com>
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 0a93684..bb18412 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -57,6 +57,8 @@  static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u8 vsi_id)
 {
 	struct i40e_pf *pf = vf->pf;
 
+	if (vsi_id > pf->num_alloc_vsi)
+		return false;
 	return pf->vsi[vsi_id]->vf_id == vf->vf_id;
 }