Skip to content

Commit

Permalink
nl80211/cfg80211: fix potential infinite loop
Browse files Browse the repository at this point in the history
The for-loop iterates with a u8 loop counter and compares this
with the loop upper limit of request->n_ssids which is an int type.
There is a potential infinite loop if n_ssids is larger than the
u8 loop counter, so fix this by making the loop counter an int.

Addresses-Coverity: ("Infinite loop")
Fixes: c8cb5b8 ("nl80211/cfg80211: support 6 GHz scanning")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201029222407.390218-1-colin.king@canonical.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Colin Ian King authored and Johannes Berg committed Nov 6, 2020
1 parent 9c97c88 commit ba5c252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request,
static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap,
struct cfg80211_scan_request *request)
{
u8 i;
int i;
u32 s_ssid;

for (i = 0; i < request->n_ssids; i++) {
Expand Down

0 comments on commit ba5c252

Please sign in to comment.