summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-05-12 18:13:55 +0100
committerDavid S. Miller <davem@davemloft.net>2020-05-13 15:20:00 -0700
commit6545be82807cc01712411321730656ad8ad30474 (patch)
tree285f4c9509d545824db78d943ccf072c7853e92d /drivers/net/ethernet/sfc
parent6cb7576710aea4dfd11449b4f514a03cd9f03505 (diff)
downloadlinux-6545be82807cc01712411321730656ad8ad30474.tar.gz
linux-6545be82807cc01712411321730656ad8ad30474.tar.bz2
linux-6545be82807cc01712411321730656ad8ad30474.zip
sfc: fix dereference of table before it is null checked
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: e4fe938cff04 ("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>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/mcdi_filters.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 88de95a8c08c..455a62814fb9 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -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);