Skip to content

Commit 6ef09cd

Browse files
dmantipovjmberg-intel
authored andcommitted
wifi: cfg80211: wext: add extra SIOCSIWSCAN data check
In 'cfg80211_wext_siwscan()', add extra check whether number of channels passed via 'ioctl(sock, SIOCSIWSCAN, ...)' doesn't exceed IW_MAX_FREQUENCIES and reject invalid request with -EINVAL otherwise. Reported-by: syzbot+253cd2d2491df77c93ac@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=253cd2d2491df77c93ac Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Link: https://msgid.link/20240531032010.451295-1-dmantipov@yandex.ru Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 0941772 commit 6ef09cd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

net/wireless/scan.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,10 +3416,14 @@ int cfg80211_wext_siwscan(struct net_device *dev,
34163416
wiphy = &rdev->wiphy;
34173417

34183418
/* Determine number of channels, needed to allocate creq */
3419-
if (wreq && wreq->num_channels)
3419+
if (wreq && wreq->num_channels) {
3420+
/* Passed from userspace so should be checked */
3421+
if (unlikely(wreq->num_channels > IW_MAX_FREQUENCIES))
3422+
return -EINVAL;
34203423
n_channels = wreq->num_channels;
3421-
else
3424+
} else {
34223425
n_channels = ieee80211_get_num_supported_channels(wiphy);
3426+
}
34233427

34243428
creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
34253429
n_channels * sizeof(void *),

0 commit comments

Comments
 (0)