• Filip Sadowski's avatar
    i40e: Fix permission check for VF MAC filters · 03ce7b1d
    Filip Sadowski authored
    When VF requests adding of MAC filters the checking is done against number
    of already present MAC filters not adding them at the same time. It makes
    it possible to add a bunch of filters at once possibly exceeding
    acceptable limit of I40E_VC_MAX_MAC_ADDR_PER_VF filters.
    
    This happens because when checking vf->num_mac, we do not check how many
    filters are being requested at once. Modify the check function to ensure
    that it knows how many filters are being requested. This allows the
    check to ensure that the total number of filters in a single request
    does not cause us to go over the limit.
    
    Additionally, move the check to within the lock to ensure that the
    vf->num_mac is checked while holding the lock to maintain consistency.
    We could have simply moved the call to i40e_vf_check_permission to
    within the loop, but this could cause a request to be non-atomic, and
    add some but not all the addresses, while reporting an error code. We
    want to avoid this behavior so that users are not confused about which
    filters have or have not been added.
    Signed-off-by: default avatarFilip Sadowski <filip.sadowski@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    03ce7b1d
i40e_virtchnl_pf.c 113 KB