Skip to content

Commit 9525a3c

Browse files
CuriousPanCakedavem330
authored andcommitted
i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters()
Add check for pf->vf not being NULL before dereferencing pf->vf[vsi->vf_id] in updating VSI filter sync. Add a similar check before dereferencing !pf->vf[vsi->vf_id].trusted in the condition for clearing promisc mode bit. Fixes: c87c938 ("i40e: Add VF VLAN pruning") Signed-off-by: Andrii Staikov <[email protected]> Signed-off-by: Aleksandr Loktionov <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent da71714 commit 9525a3c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,7 +2609,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
26092609
retval = i40e_correct_mac_vlan_filters
26102610
(vsi, &tmp_add_list, &tmp_del_list,
26112611
vlan_filters);
2612-
else
2612+
else if (pf->vf)
26132613
retval = i40e_correct_vf_mac_vlan_filters
26142614
(vsi, &tmp_add_list, &tmp_del_list,
26152615
vlan_filters, pf->vf[vsi->vf_id].trusted);
@@ -2782,7 +2782,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
27822782
}
27832783

27842784
/* if the VF is not trusted do not do promisc */
2785-
if ((vsi->type == I40E_VSI_SRIOV) && !pf->vf[vsi->vf_id].trusted) {
2785+
if (vsi->type == I40E_VSI_SRIOV && pf->vf &&
2786+
!pf->vf[vsi->vf_id].trusted) {
27862787
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
27872788
goto out;
27882789
}

0 commit comments

Comments
 (0)