Skip to content

Commit 0e833ab

Browse files
jmberg-intelgregkh
authored andcommitted
mac80211: pause TX while changing interface type
[ Upstream commit 054c993 ] syzbot reported a crash that happened when changing the interface type around a lot, and while it might have been easy to fix just the symptom there, a little deeper investigation found that really the reason is that we allowed packets to be transmitted while in the middle of changing the interface type. Disallow TX by stopping the queues while changing the type. Fixes: 34d4bc4 ("mac80211: support runtime interface type changes") Reported-by: syzbot+d7a3b15976bf7de2238a@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20210122171115.b321f98f4d4f.I6997841933c17b093535c31d29355be3c0c39628@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9f93bf0 commit 0e833ab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ enum queue_stop_reason {
10461046
IEEE80211_QUEUE_STOP_REASON_FLUSH,
10471047
IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
10481048
IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
1049+
IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE,
10491050

10501051
IEEE80211_QUEUE_STOP_REASONS,
10511052
};

net/mac80211/iface.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,10 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
15771577
if (ret)
15781578
return ret;
15791579

1580+
ieee80211_stop_vif_queues(local, sdata,
1581+
IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
1582+
synchronize_net();
1583+
15801584
ieee80211_do_stop(sdata, false);
15811585

15821586
ieee80211_teardown_sdata(sdata);
@@ -1597,6 +1601,8 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
15971601
err = ieee80211_do_open(&sdata->wdev, false);
15981602
WARN(err, "type change: do_open returned %d", err);
15991603

1604+
ieee80211_wake_vif_queues(local, sdata,
1605+
IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
16001606
return ret;
16011607
}
16021608

0 commit comments

Comments
 (0)