diff mbox

[net] sfc: fix addr_list_lock spinlock use before init

Message ID alpine.LFD.2.03.1409161654370.25290@solarflare.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Edward Cree Sept. 16, 2014, 3:57 p.m. UTC
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.
---
 drivers/net/ethernet/sfc/farch.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nikolay Aleksandrov Sept. 16, 2014, 4:02 p.m. UTC | #1
On 16/09/14 17:57, Edward Cree wrote:
> 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.
> ---
>   drivers/net/ethernet/sfc/farch.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
> index 0537381..6859437 100644
> --- a/drivers/net/ethernet/sfc/farch.c
> +++ b/drivers/net/ethernet/sfc/farch.c
> @@ -2933,6 +2933,9 @@ void efx_farch_filter_sync_rx_mode(struct efx_nic *efx)
>   	u32 crc;
>   	int bit;
>
> +	if (!efx_dev_registered(efx))
> +		return;
> +
>   	netif_addr_lock_bh(net_dev);
>
>   	efx->unicast_filter = !(net_dev->flags & IFF_PROMISC);
>

You should add a Signed-off-by, otherwise looks good to me.
FWIW, you can add my Tested-by as well.

Tested-by: Nikolay Aleksandrov <nikolay@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 0537381..6859437 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -2933,6 +2933,9 @@  void efx_farch_filter_sync_rx_mode(struct efx_nic *efx)
 	u32 crc;
 	int bit;
 
+	if (!efx_dev_registered(efx))
+		return;
+
 	netif_addr_lock_bh(net_dev);
 
 	efx->unicast_filter = !(net_dev->flags & IFF_PROMISC);