diff options
author | Alexei Avshalom Lazar <ailizaro@codeaurora.org> | 2019-06-16 03:26:03 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-06-27 13:50:28 -0400 |
commit | c478ac9daae6f19621997250900bf4fef74d3b25 (patch) | |
tree | 58958660b83a9a9c4fbab048acf448d04e2d2807 /drivers/net/wireless | |
parent | f2b6b46e483b9a084088853ecc4123118791829e (diff) |
wil6210: update cid boundary check of wil_find_cid/_by_idx()
The return value of wil_find_cid()/wil_find_cid_by_idx() is
validated with the lower boundary value.
Check the upper boundary value as well.
Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/wil6210/cfg80211.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/main.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index f94fe428c501..64da2be38760 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c | |||
@@ -380,8 +380,8 @@ static int wil_cfg80211_get_station(struct wiphy *wiphy, | |||
380 | 380 | ||
381 | wil_dbg_misc(wil, "get_station: %pM CID %d MID %d\n", mac, cid, | 381 | wil_dbg_misc(wil, "get_station: %pM CID %d MID %d\n", mac, cid, |
382 | vif->mid); | 382 | vif->mid); |
383 | if (cid < 0) | 383 | if (!wil_cid_valid(wil, cid)) |
384 | return cid; | 384 | return -ENOENT; |
385 | 385 | ||
386 | rc = wil_cid_fill_sinfo(vif, cid, sinfo); | 386 | rc = wil_cid_fill_sinfo(vif, cid, sinfo); |
387 | 387 | ||
@@ -417,7 +417,7 @@ static int wil_cfg80211_dump_station(struct wiphy *wiphy, | |||
417 | int rc; | 417 | int rc; |
418 | int cid = wil_find_cid_by_idx(wil, vif->mid, idx); | 418 | int cid = wil_find_cid_by_idx(wil, vif->mid, idx); |
419 | 419 | ||
420 | if (cid < 0) | 420 | if (!wil_cid_valid(wil, cid)) |
421 | return -ENOENT; | 421 | return -ENOENT; |
422 | 422 | ||
423 | ether_addr_copy(mac, wil->sta[cid].addr); | 423 | ether_addr_copy(mac, wil->sta[cid].addr); |
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index f7b9e6b85ef4..173561fe593d 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c | |||
@@ -340,7 +340,7 @@ static void _wil6210_disconnect_complete(struct wil6210_vif *vif, | |||
340 | wil_dbg_misc(wil, | 340 | wil_dbg_misc(wil, |
341 | "Disconnect complete %pM, CID=%d, reason=%d\n", | 341 | "Disconnect complete %pM, CID=%d, reason=%d\n", |
342 | bssid, cid, reason_code); | 342 | bssid, cid, reason_code); |
343 | if (cid >= 0) /* disconnect 1 peer */ | 343 | if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */ |
344 | wil_disconnect_cid_complete(vif, cid, reason_code); | 344 | wil_disconnect_cid_complete(vif, cid, reason_code); |
345 | } else { /* all */ | 345 | } else { /* all */ |
346 | wil_dbg_misc(wil, "Disconnect complete all\n"); | 346 | wil_dbg_misc(wil, "Disconnect complete all\n"); |
@@ -452,7 +452,7 @@ static void _wil6210_disconnect(struct wil6210_vif *vif, const u8 *bssid, | |||
452 | cid = wil_find_cid(wil, vif->mid, bssid); | 452 | cid = wil_find_cid(wil, vif->mid, bssid); |
453 | wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n", | 453 | wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n", |
454 | bssid, cid, reason_code); | 454 | bssid, cid, reason_code); |
455 | if (cid >= 0) /* disconnect 1 peer */ | 455 | if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */ |
456 | wil_disconnect_cid(vif, cid, reason_code); | 456 | wil_disconnect_cid(vif, cid, reason_code); |
457 | } else { /* all */ | 457 | } else { /* all */ |
458 | wil_dbg_misc(wil, "Disconnect all\n"); | 458 | wil_dbg_misc(wil, "Disconnect all\n"); |