Skip to content

Commit 53b1898

Browse files
committed
nl80211: always check nla_put* return values
A few instances were found where we didn't check them, add the missing checks even though they'll probably never trigger as the message should be large enough here. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 76e1fb4 commit 53b1898

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/wireless/nl80211.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9453,8 +9453,10 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
94539453
if (!freqs)
94549454
return -ENOBUFS;
94559455

9456-
for (i = 0; i < req->n_channels; i++)
9457-
nla_put_u32(msg, i, req->channels[i]->center_freq);
9456+
for (i = 0; i < req->n_channels; i++) {
9457+
if (nla_put_u32(msg, i, req->channels[i]->center_freq))
9458+
return -ENOBUFS;
9459+
}
94589460

94599461
nla_nest_end(msg, freqs);
94609462

@@ -9468,9 +9470,10 @@ static int nl80211_send_wowlan_nd(struct sk_buff *msg,
94689470
if (!match)
94699471
return -ENOBUFS;
94709472

9471-
nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
9472-
req->match_sets[i].ssid.ssid_len,
9473-
req->match_sets[i].ssid.ssid);
9473+
if (nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
9474+
req->match_sets[i].ssid.ssid_len,
9475+
req->match_sets[i].ssid.ssid))
9476+
return -ENOBUFS;
94749477
nla_nest_end(msg, match);
94759478
}
94769479
nla_nest_end(msg, matches);

0 commit comments

Comments
 (0)