mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
nl80211: fix beacon head validation
commit9a6847ba17upstream. If the beacon head attribute (NL80211_ATTR_BEACON_HEAD) is too short to even contain the frame control field, we access uninitialized data beyond the buffer. Fix this by checking the minimal required size first. We used to do this until S1G support was added, where the fixed data portion has a different size. Reported-and-tested-by: syzbot+72b99dcf4607e8c770f3@syzkaller.appspotmail.com Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Fixes:1d47f1198d("nl80211: correctly validate S1G beacon head") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://lore.kernel.org/r/20210408154518.d9b06d39b4ee.Iff908997b2a4067e8d456b3cb96cab9771d252b8@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
81692c6add
commit
42e4450e37
@@ -209,9 +209,13 @@ static int validate_beacon_head(const struct nlattr *attr,
|
||||
unsigned int len = nla_len(attr);
|
||||
const struct element *elem;
|
||||
const struct ieee80211_mgmt *mgmt = (void *)data;
|
||||
bool s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control);
|
||||
unsigned int fixedlen, hdrlen;
|
||||
bool s1g_bcn;
|
||||
|
||||
if (len < offsetofend(typeof(*mgmt), frame_control))
|
||||
goto err;
|
||||
|
||||
s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control);
|
||||
if (s1g_bcn) {
|
||||
fixedlen = offsetof(struct ieee80211_ext,
|
||||
u.s1g_beacon.variable);
|
||||
|
||||
Reference in New Issue
Block a user