]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i40e: lie to the VF
authorMitch Williams <mitch.a.williams@intel.com>
Tue, 3 May 2016 22:13:13 +0000 (15:13 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 14 May 2016 06:23:19 +0000 (23:23 -0700)
If an untrusted VF attempts to configure promiscuous mode, log a message
pointing out its naughty behavior. But then, instead of returning an
error to the offender, just lie to it and say everything's OK. It will
continue on its way, thinking it's in promiscuous mode, but receiving no
packets except its own.

Change-ID: I63369215b1720f3c531eedfc06af86ff8c0e3dc8
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 6430933f99b3e675cbfab1d8a30fb6a14f974f98..94734290907cf2cf7cfc8ba548e46621c62f0371 100644 (file)
@@ -1474,12 +1474,16 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
 
        vsi = i40e_find_vsi_from_id(pf, info->vsi_id);
        if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) ||
-           !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) ||
            !i40e_vc_isvalid_vsi_id(vf, info->vsi_id)) {
+               aq_ret = I40E_ERR_PARAM;
+               goto error_param;
+       }
+       if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
                dev_err(&pf->pdev->dev,
-                       "VF %d doesn't meet requirements to enter promiscuous mode\n",
+                       "Unprivileged VF %d is attempting to configure promiscuous mode\n",
                        vf->vf_id);
-               aq_ret = I40E_ERR_PARAM;
+               /* Lie to the VF on purpose. */
+               aq_ret = 0;
                goto error_param;
        }
        /* Multicast promiscuous handling*/