Commit 8ba7000e authored by Keith Yeo's avatar Keith Yeo Committed by Treehugger Robot
Browse files

UPSTREAM: wifi: nl80211: fix integer overflow in nl80211_parse_mbssid_elems()



nl80211_parse_mbssid_elems() uses a u8 variable num_elems to count the
number of MBSSID elements in the nested netlink attribute attrs, which can
lead to an integer overflow if a user of the nl80211 interface specifies
256 or more elements in the corresponding attribute in userspace. The
integer overflow can lead to a heap buffer overflow as num_elems determines
the size of the trailing array in elems, and this array is thereafter
written to for each element in attrs.

Note that this vulnerability only affects devices with the
wiphy->mbssid_max_interfaces member set for the wireless physical device
struct in the device driver, and can only be triggered by a process with
CAP_NET_ADMIN capabilities.

Fix this by checking for a maximum of 255 elements in attrs.

Bug: 254441685
Cc: stable@vger.kernel.org
Fixes: dc1e3cb8 ("nl80211: MBSSID and EMA support in AP mode")
Signed-off-by: default avatarKeith Yeo <keithyjy@gmail.com>
Link: https://lore.kernel.org/r/20230731034719.77206-1-keithyjy@gmail.com


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
(cherry picked from commit 6311071a)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I4a5468d5ba31807ccfa98f9cfb5beceea4e2da16
parent 12733f7f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment