* [Intel-wired-lan] [PATCH iwl-net v1] i40e: fix potential calltrace i40e_sync_vsi_filters()
@ 2023-08-02 7:48 Andrii Staikov
2023-08-04 21:29 ` Tony Nguyen
0 siblings, 1 reply; 2+ messages in thread
From: Andrii Staikov @ 2023-08-02 7:48 UTC (permalink / raw)
To: intel-wired-lan; +Cc: Aleksandr Loktionov, Andrii Staikov
Add defensive check for pf->vf != NULL before referencing pf->vf[].
Fixes: c87c938f62d8 ("i40e: Add VF VLAN pruning")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Andrii Staikov <andrii.staikov@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 29ad1797adce..a86bfa3bba74 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -2609,7 +2609,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
retval = i40e_correct_mac_vlan_filters
(vsi, &tmp_add_list, &tmp_del_list,
vlan_filters);
- else
+ else if (pf->vf)
retval = i40e_correct_vf_mac_vlan_filters
(vsi, &tmp_add_list, &tmp_del_list,
vlan_filters, pf->vf[vsi->vf_id].trusted);
@@ -2782,7 +2782,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
}
/* if the VF is not trusted do not do promisc */
- if ((vsi->type == I40E_VSI_SRIOV) && !pf->vf[vsi->vf_id].trusted) {
+ if (vsi->type == I40E_VSI_SRIOV && pf->vf &&
+ !pf->vf[vsi->vf_id].trusted) {
clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
goto out;
}
--
2.25.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Intel-wired-lan] [PATCH iwl-net v1] i40e: fix potential calltrace i40e_sync_vsi_filters()
2023-08-02 7:48 [Intel-wired-lan] [PATCH iwl-net v1] i40e: fix potential calltrace i40e_sync_vsi_filters() Andrii Staikov
@ 2023-08-04 21:29 ` Tony Nguyen
0 siblings, 0 replies; 2+ messages in thread
From: Tony Nguyen @ 2023-08-04 21:29 UTC (permalink / raw)
To: Andrii Staikov, intel-wired-lan; +Cc: Aleksandr Loktionov
On 8/2/2023 12:48 AM, Andrii Staikov wrote:
> Add defensive check for pf->vf != NULL before referencing pf->vf[].
Please add more info on how this can occur/Why are you adding this
check? How was this found? An actual call trace, static analysis, code
inspection, other? If a call trace, putting it here would be useful.
> Fixes: c87c938f62d8 ("i40e: Add VF VLAN pruning")
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Andrii Staikov <andrii.staikov@intel.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 29ad1797adce..a86bfa3bba74 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -2609,7 +2609,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
> retval = i40e_correct_mac_vlan_filters
> (vsi, &tmp_add_list, &tmp_del_list,
> vlan_filters);
> - else
> + else if (pf->vf)
> retval = i40e_correct_vf_mac_vlan_filters
> (vsi, &tmp_add_list, &tmp_del_list,
> vlan_filters, pf->vf[vsi->vf_id].trusted);
> @@ -2782,7 +2782,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
> }
>
> /* if the VF is not trusted do not do promisc */
> - if ((vsi->type == I40E_VSI_SRIOV) && !pf->vf[vsi->vf_id].trusted) {
> + if (vsi->type == I40E_VSI_SRIOV && pf->vf &&
> + !pf->vf[vsi->vf_id].trusted) {
> clear_bit(__I40E_VSI_OVERFLOW_PROMISC, vsi->state);
> goto out;
> }
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-04 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 7:48 [Intel-wired-lan] [PATCH iwl-net v1] i40e: fix potential calltrace i40e_sync_vsi_filters() Andrii Staikov
2023-08-04 21:29 ` Tony Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox