All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Fix regulatory bug with multiple cards with a delayed CRDA response
@ 2010-11-12  2:27 Luis R. Rodriguez
  2010-11-12  2:45 ` Luis R. Rodriguez
  2010-11-12  6:05 ` Mark Mentovai
  0 siblings, 2 replies; 10+ messages in thread
From: Luis R. Rodriguez @ 2010-11-12  2:27 UTC (permalink / raw)
  To: linville; +Cc: mark, linux-wireless, Luis R. Rodriguez, stable

When two cards are connected with the same regulatory domain
if CRDA had a delayed response then cfg80211's own set regulatory
domain would still be the world regulatory domain. There was a bug
on cfg80211's ignore_request() when analyzing incoming driver
regulatory hints as it was only checking against the currently
set cfg80211 regulatory domain and not for any other new
pending requests. This is easily fixed by also checking against
the pending request.

Without this fix the second card would end up with an intersected
regulatory domain and now allow it to use the channels it really
is designed for.

This was reproduced and tested against mac80211_hwsim using this
CRDA delayer:

	#!/bin/bash
	echo $COUNTRY >> /tmp/log
	sleep 2
	/sbin/crda.orig

And this regulatory test:

	modprobe mac80211_hwsim regtest=2

This patch has fixes for cfg80211 all the way back.

Reported-by: Mark Mentovai <mark@moxienet.com>
Cc: stable@kernel.org
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/reg.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 3be18d9..ecac993 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1281,9 +1281,13 @@ static int ignore_request(struct wiphy *wiphy,
 		 * This would happen if you unplug and plug your card
 		 * back in or if you add a new device for which the previously
 		 * loaded card also agrees on the regulatory domain.
+		 * This can also happen if you have two cards both with the
+		 * same regulatory domain and CRDA hasn't yet replied back
+		 * with the last request's regulatory domain.
 		 */
 		if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
-		    !regdom_changes(pending_request->alpha2))
+		    (!regdom_changes(pending_request->alpha2) ||
+		     alpha2_equal(last_request->alpha2, pending_request->alpha2)))
 			return -EALREADY;
 
 		return REG_INTERSECT;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-16 21:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12  2:27 [PATCH] cfg80211: Fix regulatory bug with multiple cards with a delayed CRDA response Luis R. Rodriguez
2010-11-12  2:45 ` Luis R. Rodriguez
2010-11-12  2:53   ` Luis R. Rodriguez
2010-11-12  6:05 ` Mark Mentovai
2010-11-12 20:27   ` Luis R. Rodriguez
2010-11-16  0:06     ` Luis R. Rodriguez
2010-11-16  0:33       ` Luis R. Rodriguez
2010-11-16  3:34       ` Mark Mentovai
2010-11-16 20:27         ` Luis R. Rodriguez
2010-11-16 21:34           ` Mark Mentovai

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.