netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters()
@ 2023-08-22 22:16 Tony Nguyen
  2023-08-23 10:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Nguyen @ 2023-08-22 22:16 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Andrii Staikov, anthony.l.nguyen, Aleksandr Loktionov,
	Rafal Romanowski

From: Andrii Staikov <andrii.staikov@intel.com>

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: c87c938f62d8 ("i40e: Add VF VLAN pruning")
Signed-off-by: Andrii Staikov <andrii.staikov@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@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.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters()
  2023-08-22 22:16 [PATCH net] i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters() Tony Nguyen
@ 2023-08-23 10:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-23 10:50 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, netdev, andrii.staikov,
	aleksandr.loktionov, rafal.romanowski

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 22 Aug 2023 15:16:53 -0700 you wrote:
> From: Andrii Staikov <andrii.staikov@intel.com>
> 
> 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.
> 
> [...]

Here is the summary with links:
  - [net] i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters()
    https://git.kernel.org/netdev/net/c/9525a3c38acc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-23 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-22 22:16 [PATCH net] i40e: fix potential NULL pointer dereferencing of pf->vf i40e_sync_vsi_filters() Tony Nguyen
2023-08-23 10:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).