Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / net / wireless / nl80211.c
index f2a77c3..fd111e2 100644 (file)
@@ -7014,7 +7014,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
 
                params.n_counter_offsets_presp = len / sizeof(u16);
                if (rdev->wiphy.max_num_csa_counters &&
-                   (params.n_counter_offsets_beacon >
+                   (params.n_counter_offsets_presp >
                     rdev->wiphy.max_num_csa_counters))
                        return -EINVAL;
 
@@ -8022,6 +8022,8 @@ __cfg80211_alloc_vendor_skb(struct cfg80211_registered_device *rdev,
        }
 
        data = nla_nest_start(skb, attr);
+       if (!data)
+               goto nla_put_failure;
 
        ((void **)skb->cb)[0] = rdev;
        ((void **)skb->cb)[1] = hdr;
@@ -9451,18 +9453,27 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
        if (!freqs)
                return -ENOBUFS;
 
-       for (i = 0; i < req->n_channels; i++)
-               nla_put_u32(msg, i, req->channels[i]->center_freq);
+       for (i = 0; i < req->n_channels; i++) {
+               if (nla_put_u32(msg, i, req->channels[i]->center_freq))
+                       return -ENOBUFS;
+       }
 
        nla_nest_end(msg, freqs);
 
        if (req->n_match_sets) {
                matches = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_MATCH);
+               if (!matches)
+                       return -ENOBUFS;
+
                for (i = 0; i < req->n_match_sets; i++) {
                        match = nla_nest_start(msg, i);
-                       nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
-                               req->match_sets[i].ssid.ssid_len,
-                               req->match_sets[i].ssid.ssid);
+                       if (!match)
+                               return -ENOBUFS;
+
+                       if (nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
+                                   req->match_sets[i].ssid.ssid_len,
+                                   req->match_sets[i].ssid.ssid))
+                               return -ENOBUFS;
                        nla_nest_end(msg, match);
                }
                nla_nest_end(msg, matches);
@@ -9474,6 +9485,9 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
 
        for (i = 0; i < req->n_scan_plans; i++) {
                scan_plan = nla_nest_start(msg, i + 1);
+               if (!scan_plan)
+                       return -ENOBUFS;
+
                if (!scan_plan ||
                    nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_INTERVAL,
                                req->scan_plans[i].interval) ||