]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: mac80211: fix MBSSID parsing use-after-free
authorJohannes Berg <johannes.berg@intel.com>
Fri, 14 Oct 2022 16:47:05 +0000 (18:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Oct 2022 15:24:32 +0000 (17:24 +0200)
commit684a76fc2a9a37e99602f27518895a3c5da1abe3
tree40bed5f11809993b23c6927e6d7745c27e1ac31d
parentfffbfbff7d513a709ed2ccb9b6a155cc841d8054
wifi: mac80211: fix MBSSID parsing use-after-free

Commit f279124b905209953805d9fbf77cb4277766ae17 upstream.
This is a different version of the commit, changed to store
the non-transmitted profile in the elems, and freeing it in
the few places where it's relevant, since that is only the
case when the last argument for parsing (the non-tx BSSID)
is non-NULL.

When we parse a multi-BSSID element, we might point some
element pointers into the allocated nontransmitted_profile.
However, we free this before returning, causing UAF when the
relevant pointers in the parsed elements are accessed.

Fix this by not allocating the scratch buffer separately but
as part of the returned structure instead, that way, there
are no lifetime issues with it.

The scratch buffer introduction as part of the returned data
here is taken from MLO feature work done by Ilan.

This fixes CVE-2022-42719.

Fixes: abd48b8066f3 ("mac80211: support profile split between elements")
Co-developed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c
net/mac80211/scan.c
net/mac80211/util.c