Skip to content

Commit

Permalink
cfg80211: check S1G beacon compat element length
Browse files Browse the repository at this point in the history
commit b5ac014 upstream.

We need to check the length of this element so that we don't
access data beyond its end. Fix that.

Fixes: 9eaffe5 ("cfg80211: convert S1G beacon to scan results")
Link: https://lore.kernel.org/r/20210408142826.f6f4525012de.I9fdeff0afdc683a6024e5ea49d2daa3cd2459d11@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jmberg-intel authored and gregkh committed Apr 14, 2021
1 parent fea5234 commit cc1a702
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2351,14 +2351,16 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy,
return NULL;

if (ext) {
struct ieee80211_s1g_bcn_compat_ie *compat;
u8 *ie;
const struct ieee80211_s1g_bcn_compat_ie *compat;
const struct element *elem;

ie = (void *)cfg80211_find_ie(WLAN_EID_S1G_BCN_COMPAT,
variable, ielen);
if (!ie)
elem = cfg80211_find_elem(WLAN_EID_S1G_BCN_COMPAT,
variable, ielen);
if (!elem)
return NULL;
if (elem->datalen < sizeof(*compat))
return NULL;
compat = (void *)(ie + 2);
compat = (void *)elem->data;
bssid = ext->u.s1g_beacon.sa;
capability = le16_to_cpu(compat->compat_info);
beacon_int = le16_to_cpu(compat->beacon_int);
Expand Down

0 comments on commit cc1a702

Please sign in to comment.