Skip to content

Commit

Permalink
sfc: fix dereference of table before it is null checked
Browse files Browse the repository at this point in the history
Currently pointer table is being dereferenced on a null check of
table->must_restore_filters before it is being null checked, leading
to a potential null pointer dereference issue.  Fix this by null
checking table before dereferencing it when checking for a null
table->must_restore_filters.

Addresses-Coverity: ("Dereference before null check")
Fixes: e4fe938 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Ian King authored and David S. Miller committed May 13, 2020
1 parent 6cb7576 commit 6545be8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/net/ethernet/sfc/mcdi_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx)

WARN_ON(!rwsem_is_locked(&efx->filter_sem));

if (!table->must_restore_filters)
return;

if (!table)
if (!table || !table->must_restore_filters)
return;

down_write(&table->lock);
Expand Down

0 comments on commit 6545be8

Please sign in to comment.