diff options
author | Du Cheng <ducheng2@gmail.com> | 2021-04-28 14:39:41 +0800 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2021-06-30 08:47:19 -0400 |
commit | 6a07cf36064afb14849d8e038fcca3538fe94bd4 (patch) | |
tree | 8f3895104805bfcea283ffd9caaf760a35f3778b | |
parent | a9028333001f793b2724e8be42fce3336de2cf1c (diff) | |
download | kernel_replicant_linux-6a07cf36064afb14849d8e038fcca3538fe94bd4.tar.gz kernel_replicant_linux-6a07cf36064afb14849d8e038fcca3538fe94bd4.tar.bz2 kernel_replicant_linux-6a07cf36064afb14849d8e038fcca3538fe94bd4.zip |
cfg80211: call cfg80211_leave_ocb when switching away from OCB
[ Upstream commit a64b6a25dd9f984ed05fade603a00e2eae787d2f ]
If the userland switches back-and-forth between NL80211_IFTYPE_OCB and
NL80211_IFTYPE_ADHOC via send_msg(NL80211_CMD_SET_INTERFACE), there is a
chance where the cleanup cfg80211_leave_ocb() is not called. This leads
to initialization of in-use memory (e.g. init u.ibss while in-use by
u.ocb) due to a shared struct/union within ieee80211_sub_if_data:
struct ieee80211_sub_if_data {
...
union {
struct ieee80211_if_ap ap;
struct ieee80211_if_vlan vlan;
struct ieee80211_if_managed mgd;
struct ieee80211_if_ibss ibss; // <- shares address
struct ieee80211_if_mesh mesh;
struct ieee80211_if_ocb ocb; // <- shares address
struct ieee80211_if_mntr mntr;
struct ieee80211_if_nan nan;
} u;
...
}
Therefore add handling of otype == NL80211_IFTYPE_OCB, during
cfg80211_change_iface() to perform cleanup when leaving OCB mode.
link to syzkaller bug:
https://syzkaller.appspot.com/bug?id=0612dbfa595bf4b9b680ff7b4948257b8e3732d5
Reported-by: syzbot+105896fac213f26056f9@syzkaller.appspotmail.com
Signed-off-by: Du Cheng <ducheng2@gmail.com>
Link: https://lore.kernel.org/r/20210428063941.105161-1-ducheng2@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/wireless/util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index 2731267fd0f9..4fb8d1b14e76 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1059,6 +1059,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, case NL80211_IFTYPE_MESH_POINT: /* mesh should be handled? */ break; + case NL80211_IFTYPE_OCB: + cfg80211_leave_ocb(rdev, dev); + break; default: break; } |