nl80211/cfg80211: fix potential infinite loop
authorColin Ian King <colin.king@canonical.com>
Thu, 29 Oct 2020 22:24:07 +0000 (22:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:03 +0000 (11:53 +0100)
commit615bc1ba5b87843f932ea729b6c3304f58faf7bb
tree1ee1ba680bf0091339abfc86a929edc8a08ba1ca
parent6e5ea342fc652573d29adcdeb805081dd7253e67
nl80211/cfg80211: fix potential infinite loop

[ Upstream commit ba5c25236bc3d399df82ebe923490ea8d2d35cf2 ]

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: c8cb5b854b40 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/wireless/scan.c