Skip to content

Commit 1fe4517

Browse files
simonwunderlichjmberg-intel
authored andcommitted
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: Dirk Gouders <dirk@gouders.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 76a56eb commit 1fe4517

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎net/wireless/ibss.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
262262

263263
/* try to find an IBSS channel if none requested ... */
264264
if (!wdev->wext.ibss.chandef.chan) {
265-
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
265+
struct ieee80211_channel *new_chan = NULL;
266266

267267
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
268268
struct ieee80211_supported_band *sband;
@@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
278278
continue;
279279
if (chan->flags & IEEE80211_CHAN_DISABLED)
280280
continue;
281-
wdev->wext.ibss.chandef.chan = chan;
282-
wdev->wext.ibss.chandef.center_freq1 =
283-
chan->center_freq;
281+
new_chan = chan;
284282
break;
285283
}
286284

287-
if (wdev->wext.ibss.chandef.chan)
285+
if (new_chan)
288286
break;
289287
}
290288

291-
if (!wdev->wext.ibss.chandef.chan)
289+
if (!new_chan)
292290
return -EINVAL;
291+
292+
cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
293+
NL80211_CHAN_NO_HT);
293294
}
294295

295296
/* don't join -- SSID is not there */
@@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
363364
return err;
364365

365366
if (chan) {
366-
wdev->wext.ibss.chandef.chan = chan;
367-
wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
368-
wdev->wext.ibss.chandef.center_freq1 = freq;
367+
cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
368+
NL80211_CHAN_NO_HT);
369369
wdev->wext.ibss.channel_fixed = true;
370370
} else {
371371
/* cfg80211_ibss_wext_join will pick one if needed */

0 commit comments

Comments
 (0)