linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.14 17/73] iwlwifi: mvm: clear HW_RESTART_REQUESTED when stopping the interface
Date: Wed, 31 Oct 2018 19:08:52 -0400	[thread overview]
Message-ID: <20181031230948.29203-17-sashal@kernel.org> (raw)
In-Reply-To: <20181031230948.29203-1-sashal@kernel.org>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

[ Upstream commit 155f7e0441cd121b1e673d465a35e99f4b9b2f0b ]

Fix a bug that happens in the following scenario:
1) suspend without WoWLAN
2) mac80211 calls drv_stop because of the suspend
3) __iwl_mvm_mac_stop deallocates the aux station
4) during drv_stop the firmware crashes
5) iwlmvm:
	* sets IWL_MVM_STATUS_HW_RESTART_REQUESTED
	* asks mac80211 to kick the restart flow
6) mac80211 puts the restart worker into a freezable
   queue which means that the worker will not run for now
   since the workqueue is already frozen
7) ...
8) resume
9) mac80211 runs ieee80211_reconfig as part of the resume
10) mac80211 detects that a restart flow has been requested
    and that we are now resuming from suspend and cancels
    the restart worker
11) mac80211 calls drv_start()
12) __iwl_mvm_mac_start checks that IWL_MVM_STATUS_HW_RESTART_REQUESTED
    clears it, sets IWL_MVM_STATUS_IN_HW_RESTART and calls
    iwl_mvm_restart_cleanup()
13) iwl_fw_error_dump gets called and accesses the device
    to get debug data
14) iwl_mvm_up adds the aux station
15) iwl_mvm_add_aux_sta() allocates an internal station for
    the aux station
16) iwl_mvm_allocate_int_sta() tests IWL_MVM_STATUS_IN_HW_RESTART
    and doesn't really allocate a station ID for the aux
    station
17) a new queue is added for the aux station

Note that steps from 5 to 9 aren't really part of the
problem but were described for the sake of completeness.

Once the iwl_mvm_mac_stop() is called, the device is not
accessible, meaning that step 12) can't succeed and we'll
see the following:

drivers/net/wireless/intel/iwlwifi/pcie/trans.c:2122 iwl_trans_pcie_grab_nic_access+0xc0/0x1d6 [iwlwifi]()
Timeout waiting for hardware access (CSR_GP_CNTRL 0x080403d8)
Call Trace:
[<ffffffffc03e6ad3>] iwl_trans_pcie_grab_nic_access+0xc0/0x1d6 [iwlwifi]
[<ffffffffc03e6a13>] iwl_trans_pcie_dump_regs+0x3fd/0x3fd [iwlwifi]
[<ffffffffc03dad42>] iwl_fw_error_dump+0x4f5/0xe8b [iwlwifi]
[<ffffffffc04bd43e>] __iwl_mvm_mac_start+0x5a/0x21a [iwlmvm]
[<ffffffffc04bd6d2>] iwl_mvm_mac_start+0xd4/0x103 [iwlmvm]
[<ffffffffc042d378>] drv_start+0xa1/0xc5 [iwl7000_mac80211]
[<ffffffffc045a339>] ieee80211_reconfig+0x145/0xf50 [mac80211]
[<ffffffffc044788b>] ieee80211_resume+0x62/0x66 [mac80211]
[<ffffffffc0366c5b>] wiphy_resume+0xa9/0xc6 [cfg80211]

The station id of the aux station is set to 0xff in step 3
and because we don't really allocate a new station id for
the auxliary station (as explained in 16), we end up sending
a command to the firmware asking to connect the queue
to station id 0xff. This makes the firmware crash with the
following information:

0x00002093 | ADVANCED_SYSASSERT
0x000002F0 | trm_hw_status0
0x00000000 | trm_hw_status1
0x00000B38 | branchlink2
0x0001978C | interruptlink1
0x00000000 | interruptlink2
0xFF080501 | data1
0xDEADBEEF | data2
0xDEADBEEF | data3
Firmware error during reconfiguration - reprobe!
FW error in SYNC CMD SCD_QUEUE_CFG

Fix this by clearing IWL_MVM_STATUS_HW_RESTART_REQUESTED
in iwl_mvm_mac_stop(). We won't be able to collect debug
data anyway and when we will brought up again, we will
have a clean state from the firmware perspective.
Since we won't have IWL_MVM_STATUS_IN_HW_RESTART set in
step 12) we won't get to the 2093 ASSERT either.

Fixes: bf8b286f86fc ("iwlwifi: mvm: defer setting IWL_MVM_STATUS_IN_HW_RESTART")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index db1fab9aa1c6..80a653950e86 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1225,12 +1225,15 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
 	iwl_mvm_del_aux_sta(mvm);
 
 	/*
-	 * Clear IN_HW_RESTART flag when stopping the hw (as restart_complete()
-	 * won't be called in this case).
+	 * Clear IN_HW_RESTART and HW_RESTART_REQUESTED flag when stopping the
+	 * hw (as restart_complete() won't be called in this case) and mac80211
+	 * won't execute the restart.
 	 * But make sure to cleanup interfaces that have gone down before/during
 	 * HW restart was requested.
 	 */
-	if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
+	if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) ||
+	    test_and_clear_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
+			       &mvm->status))
 		ieee80211_iterate_interfaces(mvm->hw, 0,
 					     iwl_mvm_cleanup_iterator, mvm);
 
-- 
2.17.1


  parent reply	other threads:[~2018-10-31 23:10 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 23:08 [PATCH AUTOSEL 4.14 01/73] net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 02/73] locking/lockdep: Fix debug_locks off performance problem Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 03/73] ataflop: fix error handling during setup Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 04/73] swim: fix cleanup on setup error Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 05/73] nfp: devlink port split support for 1x100G CXP NIC Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 06/73] tun: Consistently configure generic netdev params via rtnetlink Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 07/73] s390/sthyi: Fix machine name validity indication Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 08/73] hwmon: (pwm-fan) Set fan speed to 0 on suspend Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 09/73] lightnvm: pblk: fix two sleep-in-atomic-context bugs Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 10/73] spi: spi-ep93xx: Use dma_data_direction for ep93xx_spi_dma_{finish,prepare} Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 11/73] perf tools: Free temporary 'sys' string in read_event_files() Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 12/73] perf tools: Cleanup trace-event-info 'tdata' leak Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 13/73] perf strbuf: Match va_{add,copy} with va_end Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 14/73] cpupower: Fix coredump on VMWare Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 15/73] mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 16/73] iwlwifi: pcie: avoid empty free RB queue Sasha Levin
2018-10-31 23:08 ` Sasha Levin [this message]
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 18/73] x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 19/73] ACPI / processor: Fix the return value of acpi_processor_ids_walk() Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 20/73] cpufreq: dt: Try freeing static OPPs only if we have added them Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 21/73] mtd: rawnand: atmel: Fix potential NULL pointer dereference Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 22/73] regulator: fixed: Default enable high on DT regulators Sasha Levin
2018-11-01 12:06   ` Mark Brown
2018-11-01 15:48     ` Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 23/73] signal: Introduce COMPAT_SIGMINSTKSZ for use in compat_sys_sigaltstack Sasha Levin
2018-10-31 23:08 ` [PATCH AUTOSEL 4.14 24/73] Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 25/73] x86: boot: Fix EFI stub alignment Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 26/73] pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 27/73] brcmfmac: fix for proper support of 160MHz bandwidth Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 28/73] net: phy: phylink: ensure the carrier is off when starting phylink Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 29/73] block, bfq: correctly charge and reset entity service in all cases Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 30/73] kprobes: Return error if we fail to reuse kprobe instead of BUG_ON() Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 31/73] ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 32/73] pinctrl: qcom: spmi-mpp: Fix drive strength setting Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 33/73] pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 34/73] pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() " Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 35/73] net: dsa: mv88e6xxx: Fix writing to a PHY page Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 36/73] iwlwifi: mvm: fix BAR seq ctrl reporting Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 37/73] ixgbevf: VF2VF TCP RSS Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 38/73] ath10k: schedule hardware restart if WMI command times out Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 39/73] thermal: da9062/61: Prevent hardware access during system suspend Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 40/73] cgroup, netclassid: add a preemption point to write_classid Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 41/73] scsi: esp_scsi: Track residual for PIO transfers Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 42/73] UAPI: ndctl: Fix g++-unsupported initialisation in headers Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 43/73] KVM: nVMX: Clear reserved bits of #DB exit qualification Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 44/73] scsi: megaraid_sas: fix a missing-check bug Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 45/73] RDMA/core: Do not expose unsupported counters Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 46/73] IB/ipoib: Clear IPCB before icmp_send Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 47/73] RDMA/bnxt_re: Fix recursive lock warning in debug kernel Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 48/73] usb: host: ohci-at91: fix request of irq for optional gpio Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 49/73] PCI: mediatek: Fix mtk_pcie_find_port() endpoint/port matching logic Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 50/73] tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 51/73] Drivers: hv: vmbus: Use cpumask_var_t for on-stack cpu mask Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 52/73] Drivers: hv: kvp: Fix two "this statement may fall through" warnings Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 53/73] VMCI: Resource wildcard match fixed Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 54/73] PCI / ACPI: Enable wake automatically for power managed bridges Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 55/73] usb: gadget: udc: atmel: handle at91sam9rl PMC Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 56/73] ext4: fix argument checking in EXT4_IOC_MOVE_EXT Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 57/73] MD: fix invalid stored role for a disk Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 58/73] f2fs: fix to recover inode's i_flags during POR Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 59/73] PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 60/73] coresight: etb10: Fix handling of perf mode Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 61/73] PCI: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 62/73] crypto: caam - fix implicit casts in endianness helpers Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 63/73] usb: chipidea: Prevent unbalanced IRQ disable Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 64/73] driver/dma/ioat: Call del_timer_sync() without holding prep_lock Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 65/73] uio: ensure class is registered before devices Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 66/73] scsi: lpfc: Correct soft lockup when running mds diagnostics Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 67/73] scsi: lpfc: Correct race with abort on completion path Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 68/73] f2fs: report error if quota off error during umount Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 69/73] signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 70/73] mfd: menelaus: Fix possible race condition and leak Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 71/73] dmaengine: dma-jz4780: Return error if not probed from DT Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 72/73] IB/rxe: fix for duplicate request processing and ack psns Sasha Levin
2018-10-31 23:09 ` [PATCH AUTOSEL 4.14 73/73] ALSA: hda: Check the non-cached stream buffers more explicitly 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=20181031230948.29203-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=emmanuel.grumbach@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).