]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.123/iwlwifi-pcie-don-t-crash-on-invalid-rx-interrupt.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.123 / iwlwifi-pcie-don-t-crash-on-invalid-rx-interrupt.patch
CommitLineData
3d4ecfe4
SL
1From a68d3e1dbd65ff3c3adfe0698b7489e875257c76 Mon Sep 17 00:00:00 2001
2From: Johannes Berg <johannes.berg@intel.com>
3Date: Tue, 5 Mar 2019 10:31:11 +0100
4Subject: iwlwifi: pcie: don't crash on invalid RX interrupt
5
6[ Upstream commit 30f24eabab8cd801064c5c37589d803cb4341929 ]
7
8If for some reason the device gives us an RX interrupt before we're
9ready for it, perhaps during device power-on with misconfigured IRQ
10causes mapping or so, we can crash trying to access the queues.
11
12Prevent that by checking that we actually have RXQs and that they
13were properly allocated.
14
15Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
17Signed-off-by: Sasha Levin <sashal@kernel.org>
18---
19 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
23index a40ad4675e19e..953e0254a94c1 100644
24--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
25+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
26@@ -1252,10 +1252,15 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
27 static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue)
28 {
29 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
30- struct iwl_rxq *rxq = &trans_pcie->rxq[queue];
31+ struct iwl_rxq *rxq;
32 u32 r, i, count = 0;
33 bool emergency = false;
34
35+ if (WARN_ON_ONCE(!trans_pcie->rxq || !trans_pcie->rxq[queue].bd))
36+ return;
37+
38+ rxq = &trans_pcie->rxq[queue];
39+
40 restart:
41 spin_lock(&rxq->lock);
42 /* uCode's read index (stored in shared DRAM) indicates the last Rx
43--
442.20.1
45