From: Simon Wunderlich <sw@simonwunderlich.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH] mac80211: fix iflist_mtx/mtx locking in radar detection
Date: Wed, 18 Dec 2013 15:51:40 +0100 [thread overview]
Message-ID: <201312181551.40786.sw@simonwunderlich.de> (raw)
In-Reply-To: <1387358026-25741-1-git-send-email-johannes@sipsolutions.net>
> From: Johannes Berg <johannes.berg@intel.com>
>
> 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@qca.qualcomm.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
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
next prev parent reply other threads:[~2013-12-18 14:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 9:13 [PATCH] mac80211: fix iflist_mtx/mtx locking in radar detection Johannes Berg
2013-12-18 14:51 ` Simon Wunderlich [this message]
2013-12-18 16:58 ` Jones Desougi
2013-12-18 17:02 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201312181551.40786.sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.