Search Linux Wireless

Re: [PATCH 5/7] mac80211: improve CSA locking

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

 



On 20 January 2014 15:21, Michal Kazior <michal.kazior@xxxxxxxxx> wrote:
> The patch improves channel switch related locking
> (STA, IBSS, AP, mesh).
>
> Now read access to sdata->vif.csa_active is
> protected by wdev.mtx and local->mtx so holding
> either is enough for read access but both are
> required for write access. Keep in mind sdata lock
> must be taken before local->mtx. Taking them in
> reverse order creates a deadlock situation.
>
> The only exception is ieee80211_beacon_get_tim()
> but it's safe to leave it as is and it doesn't
> influence mac80211 state in any way.
>
> The patch adds a few lockdep assertions along for
> easier code/locking maintenance.
>
> This also prepares for multi-interface CSA.
>
> Signed-off-by: Michal Kazior <michal.kazior@xxxxxxxxx>
> ---
>  net/mac80211/cfg.c   | 22 +++++++++++++++++++---
>  net/mac80211/ibss.c  | 18 ++++++++++++++----
>  net/mac80211/iface.c | 28 ++++++++++++++++++++++++++--
>  net/mac80211/mesh.c  | 18 ++++++++++++++++--
>  net/mac80211/mlme.c  | 20 ++++++++++++++------
>  5 files changed, 89 insertions(+), 17 deletions(-)
>

[..]

> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index bfb81cb..d898dc9 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -1987,10 +1988,9 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
>         u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
>
>         sdata_lock(sdata);
> -       if (!ifmgd->associated) {
> -               sdata_unlock(sdata);
> -               return;
> -       }
> +       mutex_lock(&sdata->local->mtx);
> +       if (!ifmgd->associated)
> +               goto out;
>
>         ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
>                                WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,

Just noticed ths deadlocks STA CSA failpath. This deadlocks with
ieee80211_set_disassoc() -> ieee80211_stop_poll() and mutex around
ieee80211_vif_release_channel(). I suppose
s/ieee80211_stop_poll/__ieee80211_stop/ and removing explicit
local->mtx lock around ieee80211_vif_relase_channel() should be
enough.


Michał
--
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