Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Andrii Staikov <andrii.staikov@intel.com>,
	<intel-wired-lan@lists.osuosl.org>
Cc: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v1] i40e: fix potential calltrace i40e_sync_vsi_filters()
Date: Fri, 4 Aug 2023 14:29:35 -0700	[thread overview]
Message-ID: <cb5555ae-e829-68ce-7afc-4f3e2498f327@intel.com> (raw)
In-Reply-To: <20230802074840.3650208-1-andrii.staikov@intel.com>

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

      reply	other threads:[~2023-08-04 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb5555ae-e829-68ce-7afc-4f3e2498f327@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrii.staikov@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox