Commit 1fe4517c authored by Simon Wunderlich's avatar Simon Wunderlich Committed by Johannes Berg

cfg80211: fix ibss wext chandef creation

The wext internal chandefs for ibss should be created using the
cfg80211_chandef_create() functions. Initializing fields manually is
error-prone.
Reported-by: default avatarDirk Gouders <dirk@gouders.net>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 76a56eb3
...@@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, ...@@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
/* try to find an IBSS channel if none requested ... */ /* try to find an IBSS channel if none requested ... */
if (!wdev->wext.ibss.chandef.chan) { if (!wdev->wext.ibss.chandef.chan) {
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; struct ieee80211_channel *new_chan = NULL;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) { for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
...@@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, ...@@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
continue; continue;
if (chan->flags & IEEE80211_CHAN_DISABLED) if (chan->flags & IEEE80211_CHAN_DISABLED)
continue; continue;
wdev->wext.ibss.chandef.chan = chan; new_chan = chan;
wdev->wext.ibss.chandef.center_freq1 =
chan->center_freq;
break; break;
} }
if (wdev->wext.ibss.chandef.chan) if (new_chan)
break; break;
} }
if (!wdev->wext.ibss.chandef.chan) if (!new_chan)
return -EINVAL; return -EINVAL;
cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
NL80211_CHAN_NO_HT);
} }
/* don't join -- SSID is not there */ /* don't join -- SSID is not there */
...@@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, ...@@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
return err; return err;
if (chan) { if (chan) {
wdev->wext.ibss.chandef.chan = chan; cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; NL80211_CHAN_NO_HT);
wdev->wext.ibss.chandef.center_freq1 = freq;
wdev->wext.ibss.channel_fixed = true; wdev->wext.ibss.channel_fixed = true;
} else { } else {
/* cfg80211_ibss_wext_join will pick one if needed */ /* cfg80211_ibss_wext_join will pick one if needed */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment