Search Linux Wireless

Re: [PATCH] mac80211: fix iflist_mtx/mtx locking in radar detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Johannes Berg <johannes.berg@xxxxxxxxx>
> 
> The scan code creates an iflist_mtx -> mtx locking dependency,
> and a few other places, notably radar detection, were creating
> the opposite dependency, causing lockdep to complain. As scan
> and radar detection are mutually exclusive, the deadlock can't
> really happen in practice, but it's still bad form.
> 
> A similar issue exists in the monitor mode code, but this is
> only used by channel-context drivers right now and those have
> to have hardware scan, so that also can't happen.
> 
> Still, fix these issues by making some of the channel context
> code require the mtx to be held rather than acquiring it, thus
> allowing the monitor/radar callers to keep the iflist_mtx->mtx
> lock ordering.
> 
> While at it, also fix access to the local->scanning variable
> in the radar code, and document that radar_detect_enabled is
> now properly protected by the mtx.
> 
> Reported-by: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>

There are two little issues (see below). Otherwise this appears to fix the 
problem Kalle reported, at least I can now scan and start hostap (using ath9k) 
without getting this lockdep splat. If you want, add my Tested-by or Acked-by. 

> @@ -1944,8 +1951,10 @@ static int ieee80211_join_mesh(struct wiphy *wiphy,
> struct net_device *dev, sdata->smps_mode = IEEE80211_SMPS_OFF;
>  	sdata->needed_rx_chains = sdata->local->rx_chains;
> 
> +	mutex_lock(&local->mtx);
>  	err = ieee80211_vif_use_channel(sdata, &setup->chandef,
>  					IEEE80211_CHANCTX_SHARED);
> +	mutex_unlock(&local->mtx);
>  	if (err)
>  		return err;

local is not defined in ieee80211_join_mesh().

> 
> @@ -1957,7 +1966,9 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy,
> struct net_device *dev) struct ieee80211_sub_if_data *sdata =
> IEEE80211_DEV_TO_SUB_IF(dev);
> 
>  	ieee80211_stop_mesh(sdata);
> +	mutex_lock(&local->mtx);
>  	ieee80211_vif_release_channel(sdata);
> +	mutex_unlock(&local->mtx);
> 
>  	return 0;
>  }

Same problem here.

Thanks!
    Simon

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux