Skip to content

Commit 25a1726

Browse files
egrumbachjmberg-intel
authored andcommitted
iwlwifi: don't handle masked interrupt
This can lead to a panic if the driver isn't ready to handle them. Since our interrupt line is shared, we can get an interrupt at any time (and CONFIG_DEBUG_SHIRQ checks that even when the interrupt is being freed). If the op_mode has gone away, we musn't call it. To avoid this the transport disables the interrupts when the hw is stopped and the op_mode is leaving. If there is an event that would cause an interrupt the INTA register is updated regardless of the enablement of the interrupts: even if the interrupts are disabled, the INTA will be changed, but the device won't issue an interrupt. But the ISR can be called at any time, so we ought ignore the value in the INTA otherwise we can call the op_mode after it was freed. I found this bug when the op_mode_start failed, and called iwl_trans_stop_hw(trans, true). Then I played with the RFKILL button, and removed the module. While removing the module, the IRQ is freed, and the ISR is called (CONFIG_DEBUG_SHIRQ enabled). Panic. Cc: stable@vger.kernel.org Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 27edb1a commit 25a1726

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • drivers/net/wireless/iwlwifi/pcie

‎drivers/net/wireless/iwlwifi/pcie/rx.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,12 +1103,20 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
11031103
* back-to-back ISRs and sporadic interrupts from our NIC.
11041104
* If we have something to service, the tasklet will re-enable ints.
11051105
* If we *don't* have something, we'll re-enable before leaving here. */
1106-
inta_mask = iwl_read32(trans, CSR_INT_MASK); /* just for debug */
1106+
inta_mask = iwl_read32(trans, CSR_INT_MASK);
11071107
iwl_write32(trans, CSR_INT_MASK, 0x00000000);
11081108

11091109
/* Discover which interrupts are active/pending */
11101110
inta = iwl_read32(trans, CSR_INT);
11111111

1112+
if (inta & (~inta_mask)) {
1113+
IWL_DEBUG_ISR(trans,
1114+
"We got a masked interrupt (0x%08x)...Ack and ignore\n",
1115+
inta & (~inta_mask));
1116+
iwl_write32(trans, CSR_INT, inta & (~inta_mask));
1117+
inta &= inta_mask;
1118+
}
1119+
11121120
/* Ignore interrupt if there's nothing in NIC to service.
11131121
* This may be due to IRQ shared with another device,
11141122
* or due to sporadic interrupts thrown from our NIC. */
@@ -1190,7 +1198,7 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data)
11901198
* If we have something to service, the tasklet will re-enable ints.
11911199
* If we *don't* have something, we'll re-enable before leaving here.
11921200
*/
1193-
inta_mask = iwl_read32(trans, CSR_INT_MASK); /* just for debug */
1201+
inta_mask = iwl_read32(trans, CSR_INT_MASK);
11941202
iwl_write32(trans, CSR_INT_MASK, 0x00000000);
11951203

11961204
/* Ignore interrupt if there's nothing in NIC to service.

0 commit comments

Comments
 (0)