]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iwlwifi: pcie: don't crash on invalid RX interrupt
authorJohannes Berg <johannes.berg@intel.com>
Tue, 5 Mar 2019 09:31:11 +0000 (10:31 +0100)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 29 Apr 2019 15:42:45 +0000 (18:42 +0300)
If for some reason the device gives us an RX interrupt before we're
ready for it, perhaps during device power-on with misconfigured IRQ
causes mapping or so, we can crash trying to access the queues.

Prevent that by checking that we actually have RXQs and that they
were properly allocated.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/rx.c

index 69fcfa930791c9e322f1df83e1b3d9046ffb88b3..413937824764e838333e33e9e46b574bf4189986 100644 (file)
@@ -1429,10 +1429,15 @@ out_err:
 static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue)
 {
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-       struct iwl_rxq *rxq = &trans_pcie->rxq[queue];
+       struct iwl_rxq *rxq;
        u32 r, i, count = 0;
        bool emergency = false;
 
+       if (WARN_ON_ONCE(!trans_pcie->rxq || !trans_pcie->rxq[queue].bd))
+               return;
+
+       rxq = &trans_pcie->rxq[queue];
+
 restart:
        spin_lock(&rxq->lock);
        /* uCode's read index (stored in shared DRAM) indicates the last Rx