]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mac80211: return an error when SIWRATE doesn't match any rate
authorAndrew Lutomirski <andy@luto.us>
Fri, 4 Jan 2008 05:03:19 +0000 (21:03 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jan 2008 07:30:10 +0000 (23:30 -0800)
Currently mac80211 fails silently when trying to set a nonexistent
rate.  Return an error instead.

Signed-Off-By: Andy Lutomirski <luto@myrealbox.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_ioctl.c

index 7027eed4d4ae3a374fff7439110e80d44069a8fb..308bbe4a13333b103bd4d31f676da35fadcb4e48 100644 (file)
@@ -591,7 +591,7 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
        sdata->bss->force_unicast_rateidx = -1;
        if (rate->value < 0)
                return 0;
-       for (i=0; i< mode->num_rates; i++) {
+       for (i=0; i < mode->num_rates; i++) {
                struct ieee80211_rate *rates = &mode->rates[i];
                int this_rate = rates->rate;
 
@@ -599,10 +599,10 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
                        sdata->bss->max_ratectrl_rateidx = i;
                        if (rate->fixed)
                                sdata->bss->force_unicast_rateidx = i;
-                       break;
+                       return 0;
                }
        }
-       return 0;
+       return -EINVAL;
 }
 
 static int ieee80211_ioctl_giwrate(struct net_device *dev,