From: Johannes Berg <johannes@sipsolutions.net>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Pedro Francisco <pedrogfrancisco@gmail.com>,
ML linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: unloading WiFi modules is usually triggering kernel crash
Date: Mon, 15 Oct 2012 13:03:24 +0200 [thread overview]
Message-ID: <1350299004.27801.4.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <20121012121333.GA30816@redhat.com>
On Fri, 2012-10-12 at 14:13 +0200, Stanislaw Gruszka wrote:
> On Tue, Oct 09, 2012 at 10:14:40AM +0100, Pedro Francisco wrote:
> > So, I'm guessing this means it is related to what you found on iwlwifi
> > (even if I'm on iwlegacy)?
>
> Yes, this seems to be cfg80211 problem. I think crash happen because
> cfg80211 is in disassociate state (i.e. has wdev->current_bss NULL) and
> erroneously mac80211 stays in associate state. So while we unload
> module cfg80211_mlme_down() we do not call ieee80211_deauth().
>
> I think this state mishmash happens because wrong behaviour on
> __cfg80211_mlme_deauth(). Below patch try to correct that.
> Can you check if it prevent a crash? On my environment I can
> not reproduce this problem reliably.
Ugh, yeah, what was I thinking with the code below ... ??
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index ab78b53..9b99b60 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1218,6 +1218,7 @@ struct cfg80211_deauth_request {
> const u8 *ie;
> size_t ie_len;
> u16 reason_code;
> + bool local_state_change;
> };
>
> /**
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index e714ed8..e510a33 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -3549,6 +3549,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
> {
> struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
> + bool tx = !req->local_state_change;
>
> mutex_lock(&ifmgd->mtx);
>
> @@ -3565,12 +3566,12 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
> if (ifmgd->associated &&
> ether_addr_equal(ifmgd->associated->bssid, req->bssid)) {
> ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
> - req->reason_code, true, frame_buf);
> + req->reason_code, tx, frame_buf);
> } else {
> drv_mgd_prepare_tx(sdata->local, sdata);
> ieee80211_send_deauth_disassoc(sdata, req->bssid,
> IEEE80211_STYPE_DEAUTH,
> - req->reason_code, true,
> + req->reason_code, tx,
> frame_buf);
> }
>
> diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
> index 3df195a..4954010 100644
> --- a/net/wireless/mlme.c
> +++ b/net/wireless/mlme.c
> @@ -457,21 +457,11 @@ int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
> .reason_code = reason,
> .ie = ie,
> .ie_len = ie_len,
> + .local_state_change = local_state_change,
> };
>
> ASSERT_WDEV_LOCK(wdev);
>
> - if (local_state_change) {
> - if (wdev->current_bss &&
> - ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
> - cfg80211_unhold_bss(wdev->current_bss);
> - cfg80211_put_bss(&wdev->current_bss->pub);
> - wdev->current_bss = NULL;
> - }
> -
> - return 0;
> - }
> -
This looks fine to me. Probably needs Cc: stable?
Then again, maybe if the deauth request is for a BSS that *isn't* the
current BSS we should "swallow" it in cfg80211? IOW, something like
if (local_state_change && (!wdev->current_bss ||
!ether_addr_equal(...))
return 0;
since neither mac80211 nor cfg80211 track authentication... Doesn't
matter much though.
johannes
next prev parent reply other threads:[~2012-10-15 11:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 12:54 unloading WiFi modules is usually triggering kernel crash Pedro Francisco
2012-07-31 13:13 ` John W. Linville
2012-08-07 10:22 ` Stanislaw Gruszka
2012-08-30 15:58 ` Pedro Francisco
2012-09-26 12:47 ` Pedro Francisco
2012-10-03 14:30 ` Stanislaw Gruszka
2012-10-09 9:14 ` Pedro Francisco
2012-10-12 12:13 ` Stanislaw Gruszka
2012-10-15 11:03 ` Johannes Berg [this message]
2012-10-15 15:48 ` Pedro Francisco
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=1350299004.27801.4.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=pedrogfrancisco@gmail.com \
--cc=sgruszka@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).