All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Du Cheng <ducheng2@gmail.com>,
	syzbot+105896fac213f26056f9@syzkaller.appspotmail.com,
	Johannes Berg <johannes.berg@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 02/13] cfg80211: call cfg80211_leave_ocb when switching away from OCB
Date: Mon, 21 Jun 2021 13:55:32 -0400	[thread overview]
Message-ID: <20210621175544.736421-2-sashal@kernel.org> (raw)
In-Reply-To: <20210621175544.736421-1-sashal@kernel.org>

From: Du Cheng <ducheng2@gmail.com>

[ 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>
---
 net/wireless/util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 939320571d71..a16e805c4857 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1050,6 +1050,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;
 		}
-- 
2.30.2


  reply	other threads:[~2021-06-21 18:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 17:55 [PATCH AUTOSEL 4.9 01/13] mac80211: remove warning in ieee80211_get_sband() Sasha Levin
2021-06-21 17:55 ` Sasha Levin [this message]
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 03/13] mac80211: drop multicast fragments Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 04/13] ping: Check return value of function 'ping_queue_rcv_skb' Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 05/13] inet: annotate date races around sk->sk_txhash Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 06/13] net: caif: fix memory leak in ldisc_open Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 07/13] net/packet: annotate accesses to po->bind Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 08/13] net/packet: annotate accesses to po->ifindex Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 09/13] r8152: Avoid memcpy() over-reading of ETH_SS_STATS Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 10/13] sh_eth: " Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 11/13] r8169: " Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 12/13] net: qed: Fix memcpy() overflow of qed_dcbx_params() Sasha Levin
2021-06-21 17:55 ` [PATCH AUTOSEL 4.9 13/13] net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY Sasha Levin
2021-06-21 17:55   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210621175544.736421-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ducheng2@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+105896fac213f26056f9@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.