Skip to contentSkip to conversation

i40e: Fix NULL ptr dereference on VSI filter sync

PATCH Superseded Michał Małoszewski 2 participants 2 messages Feb 4, 2021 – Feb 5, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: Fix NULL ptr dereference on VSI filter sync

Remove the reason of null pointer dereference in sync vsi filters. Added new I40E_VSI_RELEASING flag to signalize deleting and releasing of VSI resources to sync this thread with sync filters subtask. Without this patch it is possible to start update the vsi filter list after vsi is removed, that's causing a kernel oops.

Fixes 17652c6336fd("i40e: remove unused argument")

Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/282326

---
 drivers/net/ethernet/intel/i40e/i40e.h      | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/net/ethernet/intel/i40e/i40e.h
 mode change 100644 => 100755 drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
old mode 100644
new mode 100755
index b6830e3..558b0ae
@@ -158,6 +158,7 @@ enum i40e_vsi_state_t {
 	__I40E_VSI_OVERFLOW_PROMISC,
 	__I40E_VSI_REINIT_REQUESTED,
 	__I40E_VSI_DOWN_REQUESTED,
+	__I40E_VSI_RELEASING,
 	/* This must be last as it determines the size of the BITMAP */
 	__I40E_VSI_STATE_SIZE__,
 };
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -2
old mode 100644
new mode 100755
index 3ed7f0e..de7b6f5
@@ -2634,9 +2634,9 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
 
 	for (v = 0; v < pf->num_alloc_vsi; v++) {
 		if (pf->vsi[v] &&
-		    (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED)) {
+		    (pf->vsi[v]->flags & I40E_VSI_FLAG_FILTER_CHANGED) &&
+		    !test_bit(__I40E_VSI_RELEASING, pf->vsi[v]->state)) {
 			int ret = i40e_sync_vsi_filters(pf->vsi[v]);
-
 			if (ret) {
 				/* come back and try again later */
 				set_bit(__I40E_MACVLAN_SYNC_PENDING,
@@ -13788,6 +13788,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
 		return -ENODEV;
 	}
 
+	set_bit(__I40E_VSI_RELEASING, vsi->state);
 	uplink_seid = vsi->uplink_seid;
 	if (vsi->type != I40E_VSI_SRIOV) {
 		if (vsi->netdev_registered) {
Signature · 7 lines
1.8.3.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
#1 lore raw

PATCH 1/1 i40e: Fix NULL ptr dereference on VSI filter sync

Quoted 8 lines · Micha? Ma?oszewski

Remove the reason of null pointer dereference in sync vsi filters. Added new I40E_VSI_RELEASING flag to signalize deleting and releasing of VSI resources to sync this thread with sync filters subtask. Without this patch it is possible to start update the vsi filter list after vsi is removed, that's causing a kernel oops.

Fixes 17652c6336fd("i40e: remove unused argument")

Reviewed-on: https://git-amr-1.devtools.intel.com/gerrit/282326

The Reviewed-on should not be included.

Quoted 6 lines
Quoted 7 lines
---
 drivers/net/ethernet/intel/i40e/i40e.h      | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/net/ethernet/intel/i40e/i40e.h
 mode change 100644 => 100755

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

I believe this was unintended?

ERROR: do not set execute permissions for source files #26: FILE: drivers/net/ethernet/intel/i40e/i40e.h

ERROR: do not set execute permissions for source files #40: FILE: drivers/net/ethernet/intel/i40e/i40e_main.c