Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Colin Ian King and committed by
David S. Miller
6545be82 6cb75767

+1 -4
+1 -4
drivers/net/ethernet/sfc/mcdi_filters.c
··· 1369 1369 1370 1370 WARN_ON(!rwsem_is_locked(&efx->filter_sem)); 1371 1371 1372 - if (!table->must_restore_filters) 1373 - return; 1374 - 1375 - if (!table) 1372 + if (!table || !table->must_restore_filters) 1376 1373 return; 1377 1374 1378 1375 down_write(&table->lock);