cfg80211: Validate legacy rateset.
authorBala Shanmugam <bkamatch@qca.qualcomm.com>
Fri, 20 Apr 2012 13:42:58 +0000 (19:12 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 23 Apr 2012 19:37:41 +0000 (15:37 -0400)
Legacy rates are not validated while configuring
tx rateset using iw. So below cmd is accepted by nl80211.
sudo iw wlan2 set bitrates legacy-2.4 1 2 3

Validate legacy rates and return
error if any rate in the rateset is not valid.

Signed-off-by: Bala Shanmugam <bkamatch@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/nl80211.c

index bcf6f70e518db6654349fcaf852fb33720c76179..140c1d291d4ea71f9ac80ab542aa5d0de33a8966 100644 (file)
@@ -5577,6 +5577,9 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
                                sband,
                                nla_data(tb[NL80211_TXRATE_LEGACY]),
                                nla_len(tb[NL80211_TXRATE_LEGACY]));
+                       if ((mask.control[band].legacy == 0) &&
+                           nla_len(tb[NL80211_TXRATE_LEGACY]))
+                               return -EINVAL;
                }
                if (tb[NL80211_TXRATE_MCS]) {
                        if (!ht_rateset_to_mask(