]>
Commit | Line | Data |
---|---|---|
3d4ecfe4 SL |
1 | From a68d3e1dbd65ff3c3adfe0698b7489e875257c76 Mon Sep 17 00:00:00 2001 |
2 | From: Johannes Berg <johannes.berg@intel.com> | |
3 | Date: Tue, 5 Mar 2019 10:31:11 +0100 | |
4 | Subject: iwlwifi: pcie: don't crash on invalid RX interrupt | |
5 | ||
6 | [ Upstream commit 30f24eabab8cd801064c5c37589d803cb4341929 ] | |
7 | ||
8 | If for some reason the device gives us an RX interrupt before we're | |
9 | ready for it, perhaps during device power-on with misconfigured IRQ | |
10 | causes mapping or so, we can crash trying to access the queues. | |
11 | ||
12 | Prevent that by checking that we actually have RXQs and that they | |
13 | were properly allocated. | |
14 | ||
15 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> | |
16 | Signed-off-by: Luca Coelho <luciano.coelho@intel.com> | |
17 | Signed-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 | ||
22 | diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c | |
23 | index 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 | -- | |
44 | 2.20.1 | |
45 |