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

sfc: fix addr_list_lock spinlock use before init

Reported by Nikolay Aleksandrov. In efx_init_port() we call
efx_mac_reconfigure() to work around a Falcon/A1 limitation, and this calls
efx_{arch}_filter_sync_rx_mode(), which takes the addr_list_lock; but this
lock is uninitialised, because we haven't called register_netdevice() yet.
So, in efx_farch_filter_sync_rx_mode(), check efx_dev_registered() before
doing anything else.
The EF10 equivalent, efx_ef10_filter_sync_rx_mode(), already has the
corresponding check.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Tested-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Edward Cree and committed by
David S. Miller
f650fb45 929a031d

+3
+3
drivers/net/ethernet/sfc/farch.c
··· 2933 2933 u32 crc; 2934 2934 int bit; 2935 2935 2936 + if (!efx_dev_registered(efx)) 2937 + return; 2938 + 2936 2939 netif_addr_lock_bh(net_dev); 2937 2940 2938 2941 efx->unicast_filter = !(net_dev->flags & IFF_PROMISC);