Skip to content

Commit

Permalink
wifi: cfg80211: wext: set ssids=NULL for passive scans
Browse files Browse the repository at this point in the history
commit 0941772 upstream.

In nl80211, we always set the ssids of a scan request to
NULL when n_ssids==0 (passive scan). Drivers have relied
on this behaviour in the past, so we fixed it in 6 GHz
scan requests as well, and added a warning so we'd have
assurance the API would always be called that way.

syzbot found that wext doesn't ensure that, so we reach
the check and trigger the warning. Fix the wext code to
set the ssids pointer to NULL when there are none.

Reported-by: [email protected]
Fixes: f7a8b10 ("wifi: cfg80211: fix 6 GHz scan request building")
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jmberg-intel authored and gregkh committed Jul 25, 2024
1 parent fd2f503 commit 95ad70d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2800,8 +2800,10 @@ int cfg80211_wext_siwscan(struct net_device *dev,
memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len);
creq->ssids[0].ssid_len = wreq->essid_len;
}
if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE)
if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE) {
creq->ssids = NULL;
creq->n_ssids = 0;
}
}

for (i = 0; i < NUM_NL80211_BANDS; i++)
Expand Down

0 comments on commit 95ad70d

Please sign in to comment.