From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
Luca Coelho <luciano.coelho@intel.com>,
Johannes Berg <johannes.berg@intel.com>,
Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.18 60/76] mac80211: fix a race between restart and CSA flows
Date: Mon, 24 Sep 2018 14:48:37 +0000 [thread overview]
Message-ID: <20180924144751.164410-59-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180924144751.164410-1-alexander.levin@microsoft.com>
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
[ Upstream commit f3ffb6c3a28963657eb8b02a795d75f2ebbd5ef4 ]
We hit a problem with iwlwifi that was caused by a bug in
mac80211. A bug in iwlwifi caused the firwmare to crash in
certain cases in channel switch. Because of that bug,
drv_pre_channel_switch would fail and trigger the restart
flow.
Now we had the hw restart worker which runs on the system's
workqueue and the csa_connection_drop_work worker that runs
on mac80211's workqueue that can run together. This is
obviously problematic since the restart work wants to
reconfigure the connection, while the csa_connection_drop_work
worker does the exact opposite: it tries to disconnect.
Fix this by cancelling the csa_connection_drop_work worker
in the restart worker.
Note that this can sound racy: we could have:
driver iface_work CSA_work restart_work
+++++++++++++++++++++++++++++++++++++++++++++
|
<--drv_cs ---|
<FW CRASH!>
-CS FAILED-->
| |
| cancel_work(CSA)
schedule |
CSA work |
| |
Race between those 2
But this is not possible because we flush the workqueue
in the restart worker before we cancel the CSA worker.
That would be bullet proof if we could guarantee that
we schedule the CSA worker only from the iface_work
which runs on the workqueue (and not on the system's
workqueue), but unfortunately we do have an instance
in which we schedule the CSA work outside the context
of the workqueue (ieee80211_chswitch_done).
Note also that we should probably cancel other workers
like beacon_connection_loss_work and possibly others
for different types of interfaces, at the very least,
IBSS should suffer from the exact same problem, but for
now, do the minimum to fix the actual bug that was actually
experienced and reproduced.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
net/mac80211/main.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 27cd64acaf00..66cbddd65b47 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -255,8 +255,27 @@ static void ieee80211_restart_work(struct work_struct *work)
flush_work(&local->radar_detected_work);
rtnl_lock();
- list_for_each_entry(sdata, &local->interfaces, list)
+ list_for_each_entry(sdata, &local->interfaces, list) {
+ /*
+ * XXX: there may be more work for other vif types and even
+ * for station mode: a good thing would be to run most of
+ * the iface type's dependent _stop (ieee80211_mg_stop,
+ * ieee80211_ibss_stop) etc...
+ * For now, fix only the specific bug that was seen: race
+ * between csa_connection_drop_work and us.
+ */
+ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+ /*
+ * This worker is scheduled from the iface worker that
+ * runs on mac80211's workqueue, so we can't be
+ * scheduling this worker after the cancel right here.
+ * The exception is ieee80211_chswitch_done.
+ * Then we can have a race...
+ */
+ cancel_work_sync(&sdata->u.mgd.csa_connection_drop_work);
+ }
flush_delayed_work(&sdata->dec_tailroom_needed_wk);
+ }
ieee80211_scan_cancel(local);
/* make sure any new ROC will consider local->in_reconfig */
--
2.17.1
next prev parent reply other threads:[~2018-09-24 20:51 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 14:48 [PATCH AUTOSEL 4.18 01/76] mac80211: Run TXQ teardown code before de-registering interfaces Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 02/76] mac80211_hwsim: require at least one channel Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 03/76] Btrfs: fix unexpected failure of nocow buffered writes after snapshotting when low on space Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 04/76] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 05/76] cfg80211: remove division by size of sizeof(struct ieee80211_wmm_rule) Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 06/76] btrfs: btrfs_shrink_device should call commit transaction at the end Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 08/76] scsi: csiostor: fix incorrect port capabilities Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 07/76] scsi: csiostor: add a check for NULL pointer after kmalloc() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 09/76] scsi: libata: Add missing newline at end of file Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 10/76] scsi: aacraid: fix a signedness bug Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 11/76] bpf, sockmap: fix potential use after free in bpf_tcp_close Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 13/76] bpf: sockmap, decrement copied count correctly in redirect error case Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 12/76] bpf, sockmap: fix psock refcount leak in bpf_tcp_recvmsg Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 15/76] mac80211_hwsim: correct use of IEEE80211_VHT_CAP_RXSTBC_X Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 14/76] mac80211: " Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 16/76] cfg80211: make wmm_rule part of the reg_rule structure Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 17/76] mac80211_hwsim: Fix possible Spectre-v1 for hwsim_world_regdom_custom Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 18/76] nl80211: Fix nla_put_u8 to u16 for NL80211_WMMR_TXOP Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 19/76] nl80211: Pass center frequency in kHz instead of MHz Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 20/76] bpf: fix several offset tests in bpf_msg_pull_data Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 21/76] gpio: adp5588: Fix sleep-in-atomic-context bug Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 23/76] mac80211: avoid kernel panic when building AMSDU from non-linear SKB Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 22/76] mac80211: mesh: fix HWMP sequence numbering to follow standard Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 24/76] gpiolib: acpi: Switch to cansleep version of GPIO library call Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 25/76] gpiolib-acpi: Register GpioInt ACPI event handlers from a late_initcall Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 26/76] gpio: dwapb: Fix error handling in dwapb_gpio_probe() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 27/76] bpf: fix msg->data/data_end after sg shift repair in bpf_msg_pull_data Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 29/76] bpf: fix sg shift repair start offset " Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 28/76] bpf: fix shift upon scatterlist ring wrap-around " Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 31/76] net: hns: add the code for cleaning pkt in chip Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 32/76] net: hns: add netif_carrier_off before change speed and duplex Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 33/76] sh_eth: Add R7S9210 support Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 34/76] net: mvpp2: initialize port of_node pointer Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 35/76] tc-testing: add test-cases for numeric and invalid control action Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 36/76] cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 37/76] mac80211: do not convert to A-MSDU if frag/subframe limited Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 38/76] mac80211: always account for A-MSDU header changes Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 39/76] tools/kvm_stat: fix python3 issues Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 40/76] tools/kvm_stat: fix handling of invalid paths in debugfs provider Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 41/76] tools/kvm_stat: fix updates for dead guests Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 42/76] gpio: Fix crash due to registration race Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 43/76] ARC: atomics: unbork atomic_fetch_##op() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 44/76] Revert "blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()" Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 45/76] md/raid5-cache: disable reshape completely Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 46/76] RAID10 BUG_ON in raise_barrier when force is true and conf->barrier is 0 Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 47/76] selftests: pmtu: maximum MTU for vti4 is 2^16-1-20 Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 49/76] ibmvnic: Include missing return code checks in reset function Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 48/76] selftests: pmtu: detect correct binary to ping ipv6 addresses Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 50/76] bpf: Fix bpf_msg_pull_data() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 51/76] bpf: avoid misuse of psock when TCP_ULP_BPF collides with another ULP Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 52/76] net: ethernet: cpsw-phy-sel: prefer phandle for phy sel Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 53/76] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 54/76] i2c: uniphier-f: " Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 56/76] fs/cifs: don't translate SFM_SLASH (U+F026) to backslash Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 55/76] net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 57/76] mac80211: fix an off-by-one issue in A-MSDU max_subframe computation Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 58/76] cfg80211: fix a type issue in ieee80211_chandef_to_operating_class() Sasha Levin
2018-09-24 14:48 ` Sasha Levin [this message]
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 59/76] mac80211: fix WMM TXOP calculation Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 61/76] mac80211: Fix station bandwidth setting after channel switch Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 62/76] mac80211: don't Tx a deauth frame if the AP forbade Tx Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 63/76] mac80211: shorten the IBSS debug messages Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 64/76] fsnotify: fix ignore mask logic in fsnotify() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 65/76] net/ibm/emac: wrong emac_calc_base call was used by typo Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 66/76] nds32: fix logic for module Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 68/76] nds32: Fix empty call trace Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 67/76] nds32: add NULL entry to the end of_device_id array Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 69/76] nds32: Fix get_user/put_user macro expand pointer problem Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 70/76] nds32: fix build error because of wrong semicolon Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 72/76] tools/vm/page-types.c: fix "defined but not used" warning Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 71/76] tools/vm/slabinfo.c: fix sign-compare warning Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 73/76] nds32: linker script: GCOV kernel may refers data in __exit Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 74/76] ceph: avoid a use-after-free in ceph_destroy_options() Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 75/76] firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero Sasha Levin
2018-09-24 14:48 ` [PATCH AUTOSEL 4.18 76/76] afs: Fix cell specification to permit an empty address list 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=20180924144751.164410-59-alexander.levin@microsoft.com \
--to=alexander.levin@microsoft.com \
--cc=emmanuel.grumbach@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luciano.coelho@intel.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).