Skip to content

Commit

Permalink
iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ
Browse files Browse the repository at this point in the history
In some rare cases when the HW is in a bad state, we may get this
interrupt when prph_info is not set yet.  Then we will try to
dereference it to check the sleep_notif element, which will cause an
oops.

Fix that by ignoring the interrupt if prph_info is not set yet.

Signed-off-by: Luca Coelho <[email protected]>
Link: https://lore.kernel.org/r/iwlwifi.20211219132536.0537aa562313.I183bb336345b9b3da196ba9e596a6f189fbcbd09@changeid
Signed-off-by: Luca Coelho <[email protected]>
  • Loading branch information
lucacoelho committed Dec 21, 2021
1 parent 73ca876 commit 459fc0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/wireless/intel/iwlwifi/pcie/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,12 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
}
}

if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP) {
/*
* In some rare cases when the HW is in a bad state, we may
* get this interrupt too early, when prph_info is still NULL.
* So make sure that it's not NULL to prevent crashing.
*/
if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP && trans_pcie->prph_info) {
u32 sleep_notif =
le32_to_cpu(trans_pcie->prph_info->sleep_notif);
if (sleep_notif == IWL_D3_SLEEP_STATUS_SUSPEND ||
Expand Down

0 comments on commit 459fc0f

Please sign in to comment.