[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221025123250.143952-1-shaozhengchao@huawei.com>
Date: Tue, 25 Oct 2022 20:32:50 +0800
From: Zhengchao Shao <shaozhengchao@...wei.com>
To: <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
<johannes@...solutions.net>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <alexander@...zel-home.de>, <weiyongjun1@...wei.com>,
<yuehaibing@...wei.com>, <shaozhengchao@...wei.com>
Subject: [PATCH] wifi: mac80211: fix general-protection-fault in ieee80211_subif_start_xmit()
When device is running and the interface status is changed, the gpf issue
is triggered. The problem triggering process is as follows:
Thread A: Thread B
ieee80211_runtime_change_iftype() process_one_work()
... ...
ieee80211_do_stop() ...
... ...
sdata->bss = NULL ...
... ieee80211_subif_start_xmit()
ieee80211_multicast_to_unicast
//!sdata->bss->multicast_to_unicast
cause gpf issue
When the interface status is changed, the sending queue continues to send
packets. After the bss is set to NULL, the bss is accessed. As a result,
this causes a general-protection-fault issue.
The following is the stack information:
general protection fault, probably for non-canonical address
0xdffffc000000002f: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f]
Workqueue: mld mld_ifc_work
RIP: 0010:ieee80211_subif_start_xmit+0x25b/0x1310
Call Trace:
<TASK>
dev_hard_start_xmit+0x1be/0x990
__dev_queue_xmit+0x2c9a/0x3b60
ip6_finish_output2+0xf92/0x1520
ip6_finish_output+0x6af/0x11e0
ip6_output+0x1ed/0x540
mld_sendpack+0xa09/0xe70
mld_ifc_work+0x71c/0xdb0
process_one_work+0x9bf/0x1710
worker_thread+0x665/0x1080
kthread+0x2e4/0x3a0
ret_from_fork+0x1f/0x30
</TASK>
Fixes: 107395f9cf44 ("wifi: mac80211: Drop support for TX push path")
Reported-by: syzbot+c6e8fca81c294fd5620a@...kaller.appspotmail.com
Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
---
net/mac80211/iface.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index dd9ac1f7d2ea..5a924459bfd1 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1900,6 +1900,9 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
synchronize_net();
+ if (sdata->dev)
+ netif_tx_stop_all_queues(sdata->dev);
+
ieee80211_do_stop(sdata, false);
ieee80211_teardown_sdata(sdata);
@@ -1922,6 +1925,9 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
err = ieee80211_do_open(&sdata->wdev, false);
WARN(err, "type change: do_open returned %d", err);
+ if (sdata->dev)
+ netif_tx_start_all_queues(sdata->dev);
+
ieee80211_wake_vif_queues(local, sdata,
IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE);
return ret;
--
2.17.1
Powered by blists - more mailing lists