]> git.karo-electronics.de Git - linux-beck.git/commitdiff
nl80211: prevent additions to old station flags API
authorJohannes Berg <johannes.berg@intel.com>
Thu, 10 May 2012 18:14:43 +0000 (20:14 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 16 May 2012 17:08:15 +0000 (13:08 -0400)
We don't really want/need to maintain the old
station flags API any more, so refuse changes
to new (not yet defined) flags from the old
flags API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/linux/nl80211.h
net/wireless/nl80211.c

index f296a64d103bdd5e86fb1cc3b9e1150005ae80cf..a6959f72745e1583525dc8c70565757123389915 100644 (file)
@@ -1594,6 +1594,8 @@ enum nl80211_sta_flags {
        NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
 };
 
+#define NL80211_STA_FLAG_MAX_OLD_API   NL80211_STA_FLAG_TDLS_PEER
+
 /**
  * struct nl80211_sta_flag_update - station flags mask/set
  * @mask: mask of station flags to set
index b67b1114e25a95a6f9bf0c8ce68eaff380765a85..f1b0774d098b5d2eeed6ac4543d3441dff7f7c65 100644 (file)
@@ -2410,10 +2410,16 @@ static int parse_station_flags(struct genl_info *info,
                return -EINVAL;
        }
 
-       for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++)
-               if (flags[flag])
+       for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) {
+               if (flags[flag]) {
                        params->sta_flags_set |= (1<<flag);
 
+                       /* no longer support new API additions in old API */
+                       if (flag > NL80211_STA_FLAG_MAX_OLD_API)
+                               return -EINVAL;
+               }
+       }
+
        return 0;
 }