From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Pavel Roskin <proski@gnu.org>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>,
"ath5k-devel@lists.ath5k.org" <ath5k-devel@lists.ath5k.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [ath5k-devel] BUG in wiphy_update_regulatory when loading ath5k (on latest git)
Date: Fri, 10 Apr 2009 11:11:57 -0700 [thread overview]
Message-ID: <20090410181157.GC5750@tesla> (raw)
In-Reply-To: <1239385533.24621.11.camel@mj>
On Fri, Apr 10, 2009 at 10:45:33AM -0700, Pavel Roskin wrote:
> On Fri, 2009-04-10 at 17:18 +0100, Alan Jenkins wrote:
>
> > [ 65.062652] BUG: unable to handle kernel NULL pointer dereference at
> > 00000004
> ...
> > [ 65.063330] Code: b8 da 17 e0 83 c0 04 e8 92 f9 ff ff 84 c0 75 2a 8b
> > 55 d4 8b 42 28 85 c0 74 0c 83 c0 04 e8 7c f9 ff ff 84 c0 75 14 a1 bc da
> > 17 e0 <83> 78 04 03 74 66 8b 4d d4 80 79 08 00 74 5d a1 e0 d2 17 e0 48
>
> "<83> 78 04 03" is "cmpl $0x3,0x4(%rax)", which I can find in
> disassemly of reg_is_world_roaming(), which was inlined into
> wiphy_update_regulatory().
>
> 0x3 is almost certainly NL80211_REGDOM_SET_BY_COUNTRY_IE in
> reg_is_world_roaming(). %rax must be 0, so we have a read at address
> 0x4.
>
> last_request must be NULL. The "initiator" field is at offset 4, which
> is consistent with the assembly.
>
> Thus, wiphy_update_regulatory() is called before last_request was
> assigned a value.
>
> last_request only seems to get a value in __regulatory_hint(), which is
> ultimately called by reg_todo(), a work handler.
Thanks pavel, please try this patch:
>From 94505af850bd0961a86e2786238ac0bbe0c44615 Mon Sep 17 00:00:00 2001
From: Luis R. Rodriguez <lrodriguez@atheros.com>
Date: Fri, 10 Apr 2009 11:07:43 -0700
Subject: [PATCH] cfg80211: fix bug while trying to process obeacon hints on init
During initialization we would not have received any beacons
so skip processing reg beacon hints, also adds a check to
reg_is_world_roaming() for last_request before accessing its
fields.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
net/wireless/reg.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6f25ef4..8935122 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1155,7 +1155,8 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
if (is_world_regdom(cfg80211_regdomain->alpha2) ||
(wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
return true;
- if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+ if (last_request &&
+ last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
wiphy->custom_regulatory)
return true;
return false;
@@ -1164,6 +1165,12 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
/* Reap the advantages of previously found beacons */
static void reg_process_beacons(struct wiphy *wiphy)
{
+ /*
+ * Means we are just firing up cfg80211, so no beacons would
+ * have been processed yet.
+ */
+ if (!last_request)
+ return;
if (!reg_is_world_roaming(wiphy))
return;
wiphy_update_beacon_reg(wiphy);
--
1.6.2.2.446.gfbdc0
next prev parent reply other threads:[~2009-04-10 18:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <49DF6216.8040303@tuffmail.co.uk>
2009-04-10 16:18 ` BUG in wiphy_update_regulatory when loading ath5k (on latest git) Alan Jenkins
2009-04-10 17:15 ` [ath5k-devel] " Luis R. Rodriguez
2009-04-10 17:45 ` Pavel Roskin
2009-04-10 18:11 ` Luis R. Rodriguez [this message]
2009-04-10 20:21 ` Pavel Roskin
2009-04-10 20:30 ` Alan Jenkins
2009-04-10 22:26 ` Luis R. Rodriguez
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=20090410181157.GC5750@tesla \
--to=lrodriguez@atheros.com \
--cc=alan-jenkins@tuffmail.co.uk \
--cc=ath5k-devel@lists.ath5k.org \
--cc=linux-wireless@vger.kernel.org \
--cc=proski@gnu.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 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).