Skip to content

Commit e5b72e3

Browse files
jmberg-intelKalle Valo
authored andcommitted
iwlwifi: mvm: limit maximum queue appropriately
Due to some hardware issues, queue 31 isn't usable on devices that have 32 queues (7000, 8000, 9000 families), which is correctly reflected in the configuration and TX queue initialization. However, the firmware API and queue allocation code assumes that there are 32 queues, and if something actually attempts to use #31 this leads to a NULL-pointer dereference since it's not allocated. Fix this by limiting to 31 in the IWL_MVM_DQA_MAX_DATA_QUEUE, and also add some code to catch this earlier in the future, if the configuration changes perhaps. Cc: [email protected] # v4.9+ Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20200417100405.98a79be2db6a.I3a4af6b03b87a6bc18db9b1ff9a812f397bee1fc@changeid
1 parent d8d6639 commit e5b72e3

File tree

2 files changed

+8
-3
lines changed
  • drivers/net/wireless/intel/iwlwifi

2 files changed

+8
-3
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/txq.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
99
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1010
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11-
* Copyright(c) 2019 Intel Corporation
11+
* Copyright(c) 2019 - 2020 Intel Corporation
1212
*
1313
* This program is free software; you can redistribute it and/or modify
1414
* it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
3131
* Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
3232
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3333
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34-
* Copyright(c) 2019 Intel Corporation
34+
* Copyright(c) 2019 - 2020 Intel Corporation
3535
* All rights reserved.
3636
*
3737
* Redistribution and use in source and binary forms, with or without
@@ -99,7 +99,7 @@ enum iwl_mvm_dqa_txq {
9999
IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
100100
IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9,
101101
IWL_MVM_DQA_MIN_DATA_QUEUE = 10,
102-
IWL_MVM_DQA_MAX_DATA_QUEUE = 31,
102+
IWL_MVM_DQA_MAX_DATA_QUEUE = 30,
103103
};
104104

105105
enum iwl_mvm_tx_fifo {

drivers/net/wireless/intel/iwlwifi/mvm/sta.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,11 @@ static int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id,
722722

723723
lockdep_assert_held(&mvm->mutex);
724724

725+
if (WARN(maxq >= mvm->trans->trans_cfg->base_params->num_of_queues,
726+
"max queue %d >= num_of_queues (%d)", maxq,
727+
mvm->trans->trans_cfg->base_params->num_of_queues))
728+
maxq = mvm->trans->trans_cfg->base_params->num_of_queues - 1;
729+
725730
/* This should not be hit with new TX path */
726731
if (WARN_ON(iwl_mvm_has_new_tx_api(mvm)))
727732
return -ENOSPC;

0 commit comments

Comments
 (0)