* [PATCH] mac80211: fix bugs with turbo removal
@ 2007-09-20 16:00 Johannes Berg
0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2007-09-20 16:00 UTC (permalink / raw)
To: John W. Linville; +Cc: Michael Wu, linux-wireless
It appears that I sent out/pushed the wrong patch, in the patch
that was merged some conversion were missing. This also adds
some sanity checks in places and fixes a thinko.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
This only applies to wireless-dev since all the ioctls that are touched
are not in mainline.
net/mac80211/ieee80211_ioctl.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c 2007-09-20 17:34:41.731572754 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c 2007-09-20 17:36:45.941573677 +0200
@@ -158,7 +158,7 @@ static int ieee80211_ioctl_get_hw_featur
left -= sizeof(*hdr) + clen + rlen;
hdr = (struct hostapd_ioctl_hw_modes_hdr *) pos;
- hdr->mode = mode->mode;
+ hdr->mode = mode_to_hostapd_mode(mode->mode);
hdr->num_channels = mode->num_channels;
hdr->num_rates = mode->num_rates;
@@ -714,10 +714,13 @@ static int ieee80211_ioctl_set_rate_sets
int i, mode, num_supp, num_basic, *supp, *basic, *prev;
struct ieee80211_hw_mode *hw_mode;
- mode = param->u.set_rate_sets.mode;
+ mode = hostapd_mode_to_mode(param->u.set_rate_sets.mode);
num_supp = param->u.set_rate_sets.num_supported_rates;
num_basic = param->u.set_rate_sets.num_basic_rates;
+ if (mode < 0 || mode >= NUM_IEEE80211_MODES)
+ return -EINVAL;
+
if (left < (num_supp + num_basic) * 2) {
printk(KERN_WARNING "%s: invalid length in hostapd set rate "
"sets ioctl (%d != %d)\n", dev->name, left,
@@ -878,7 +881,8 @@ static int ieee80211_ioctl_set_channel_f
int i;
list_for_each_entry(mode, &local->modes_list, list) {
- if (mode->mode == param->u.set_channel_flag.mode)
+ if (mode->mode ==
+ hostapd_mode_to_mode(param->u.set_channel_flag.mode))
goto found;
}
return -ENOENT;
@@ -1725,7 +1729,10 @@ static int ieee80211_ioctl_prism2_param(
break;
case PRISM2_PARAM_NEXT_MODE:
- local->next_mode = hostapd_mode_to_mode(value);
+ mode = hostapd_mode_to_mode(value);
+ if (mode >= NUM_IEEE80211_MODES)
+ return -EINVAL;
+ local->next_mode = mode;
break;
case PRISM2_PARAM_EAPOL:
@@ -1753,13 +1760,13 @@ static int ieee80211_ioctl_prism2_param(
break;
case PRISM2_PARAM_HW_MODES:
- mode = 1;
+ mode = 0;
local->enabled_modes = 0;
while (value) {
if (value & 1)
local->enabled_modes |=
- hostapd_mode_to_mode(mode);
- mode <<= 1;
+ (1 << hostapd_mode_to_mode(mode));
+ mode += 1;
value >>= 1;
}
break;
@@ -1872,7 +1879,7 @@ static int ieee80211_ioctl_get_prism2_pa
*param = 0;
while (mode < NUM_IEEE80211_MODES) {
if (local->enabled_modes & (1<<mode))
- *param |= mode_to_hostapd_mode(1<<mode);
+ *param |= 1 << mode_to_hostapd_mode(mode);
mode++;
}
break;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-20 15:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-20 16:00 [PATCH] mac80211: fix bugs with turbo removal Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox