From d7126f839357bd77f4b3fde06a907074d3a60979 Mon Sep 17 00:00:00 2001 From: benoit Date: Sat, 11 Jul 2009 17:33:54 +0000 Subject: [PATCH] Avoid kernel panic and returns 802.11b. Merge from branches/madwifi-dfs@3649 git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@4078 0192ed92-7a03-0410-a25b-9323aeb14dbd --- net80211/ieee80211.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/net80211/ieee80211.c b/net80211/ieee80211.c index 9a978c5..fd39f6f 100644 --- a/net80211/ieee80211.c +++ b/net80211/ieee80211.c @@ -1578,11 +1578,19 @@ enum ieee80211_phymode ieee80211_chan2mode(const struct ieee80211_channel *chan) { /* - * Callers should handle this case properly, rather than - * just relying that this function returns a sane value. - * XXX: Probably needs to be revised. + * Callers should handle this case properly, rather than just relying + * that this function returns a sane value. XXX: Probably needs to be + * revised. chan is undefined if channel is 0 for instance and kernel + * panic would happen when called by ieee80211_sta_join1() in IBSS + * mode. */ - KASSERT(chan != IEEE80211_CHAN_ANYC, ("channel not setup")); + + if (chan == NULL || + chan == IEEE80211_CHAN_ANYC) { + printk(KERN_ERR "%s: BUG channel not setup: %p\n", + __func__, chan); + return IEEE80211_MODE_11B; + } if (IEEE80211_IS_CHAN_108G(chan)) return IEEE80211_MODE_TURBO_G; -- 2.35.1