Skip to content

Commit d58299a

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc: fix attempt to translate invalid filter ID
When filter insertion fails with no rollback, we were trying to convert EFX_EF10_FILTER_ID_INVALID to an id to store in 'ids' (which is either vlan->uc or vlan->mc). This would WARN_ON_ONCE and then record a bogus filter ID of 0x1fff, neither of which is a good thing. Fixes: 0ccb998 ("sfc: fix filter_id misinterpretation in edge case") Signed-off-by: Edward Cree <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e44699d commit d58299a

File tree

1 file changed

+4
-3
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+4
-3
lines changed

drivers/net/ethernet/sfc/ef10.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5105,6 +5105,7 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
51055105

51065106
/* Insert/renew filters */
51075107
for (i = 0; i < addr_count; i++) {
5108+
EFX_WARN_ON_PARANOID(ids[i] != EFX_EF10_FILTER_ID_INVALID);
51085109
efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, 0);
51095110
efx_filter_set_eth_local(&spec, vlan->vid, addr_list[i].addr);
51105111
rc = efx_ef10_filter_insert(efx, &spec, true);
@@ -5122,11 +5123,11 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
51225123
}
51235124
return rc;
51245125
} else {
5125-
/* mark as not inserted, and carry on */
5126-
rc = EFX_EF10_FILTER_ID_INVALID;
5126+
/* keep invalid ID, and carry on */
51275127
}
5128+
} else {
5129+
ids[i] = efx_ef10_filter_get_unsafe_id(rc);
51285130
}
5129-
ids[i] = efx_ef10_filter_get_unsafe_id(rc);
51305131
}
51315132

51325133
if (multicast && rollback) {

0 commit comments

Comments
 (0)