wifi: iwlwifi: pcie: avoid a NULL pointer dereference
authorAvraham Stern <avraham.stern@intel.com>
Thu, 7 Dec 2023 02:50:17 +0000 (04:50 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 12 Dec 2023 09:14:57 +0000 (10:14 +0100)
It possible that while the rx rb is being handled, the transport has
been stopped and re-started. In this case the tx queue pointer is not
yet initialized, which will lead to a NULL pointer dereference.
Fix it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.cd0898cafd89.I0b84daae753ba9612092bf383f5c6f761446e964@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/rx.c

index 146bc7bd14fbc0d0a626e4096a186b283551c389..bc6a9f861711fdf9b2b4c3f57c46d82902b522e3 100644 (file)
@@ -1385,7 +1385,7 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
                 * if it is true then one of the handlers took the page.
                 */
 
-               if (reclaim) {
+               if (reclaim && txq) {
                        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
                        int index = SEQ_TO_INDEX(sequence);
                        int cmd_index = iwl_txq_get_cmd_index(txq, index);