]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/wireless/core.c
cfg80211: add wiphy_idx_valid to check for wiphy_idx sanity
[linux-2.6-omap-h63xx.git] / net / wireless / core.c
index 2b3e786ec53f75321a5a669979aa12c23d12a6ea..35d457b2751e2724d42e4451e11cf5e435ad6df5 100644 (file)
@@ -42,6 +42,9 @@ cfg80211_drv_by_wiphy_idx(int wiphy_idx)
 {
        struct cfg80211_registered_device *result = NULL, *drv;
 
+       if (!wiphy_idx_valid(wiphy_idx))
+               return NULL;
+
        list_for_each_entry(drv, &cfg80211_drv_list, list) {
                if (drv->wiphy_idx == wiphy_idx) {
                        result = drv;
@@ -225,7 +228,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
 
        drv->wiphy_idx = wiphy_counter++;
 
-       if (unlikely(drv->wiphy_idx < 0)) {
+       if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) {
                wiphy_counter--;
                mutex_unlock(&cfg80211_drv_mutex);
                /* ugh, wrapped! */