Skip to content

Commit 9cbbc45

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc: take correct lock in ef100_reset()
When downing and upping the ef100 filter table, we need to take a write lock on efx->filter_sem, not just a read lock, because we may kfree() the table pointers. Without this, resets cause a WARN_ON from efx_rwsem_assert_write_locked(). Fixes: a9dc3d5 ("sfc_ef100: RX filter table management and related gubbins") Signed-off-by: Edward Cree <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent db06ea3 commit 9cbbc45

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/sfc/ef100_nic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,18 +431,18 @@ static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type)
431431
/* A RESET_TYPE_ALL will cause filters to be removed, so we remove filters
432432
* and reprobe after reset to avoid removing filters twice
433433
*/
434-
down_read(&efx->filter_sem);
434+
down_write(&efx->filter_sem);
435435
ef100_filter_table_down(efx);
436-
up_read(&efx->filter_sem);
436+
up_write(&efx->filter_sem);
437437
rc = efx_mcdi_reset(efx, reset_type);
438438
if (rc)
439439
return rc;
440440

441441
netif_device_attach(efx->net_dev);
442442

443-
down_read(&efx->filter_sem);
443+
down_write(&efx->filter_sem);
444444
rc = ef100_filter_table_up(efx);
445-
up_read(&efx->filter_sem);
445+
up_write(&efx->filter_sem);
446446
if (rc)
447447
return rc;
448448

0 commit comments

Comments
 (0)