[PATCH 0/1][SRU][B][OEM-B]iwlwifi fails to work on 16 or more

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1][SRU][B][OEM-B]iwlwifi fails to work on 16 or more

AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1805088

[Impact]
Got dmesg kernel BUG while loading iwlwifi driver on machines
which has 16 or more logical CPUs
   kernel: RIP: 0010:iwl_pcie_rxq_alloc_rbs+0x1d0/0x1f0 [iwlwifi]
And it leads to wifi can't scan any APs, and leads to system hangs
while suspending.

[Fix]
Below commit contained in v4.17 fix the issue.
   ab1068d6866e iwlwifi: pcie: compare with number of IRQs requested for,
                not number of CPUs

[Regression Potential]
Low.

[Misc]
The commit is in v4.17, so ubuntu cosmic is safe.
And ubuntu xenial is safe, too, since the commit which introduces this
issue isn't contained in v4.4 kernel
   2e5d4a8f61dc iwlwifi: pcie: Add new configuration to enable MSIX

Hao Wei Tee (1):
  iwlwifi: pcie: compare with number of IRQs requested for, not number
    of CPUs

 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1][SRU][B][OEM-B]iwlwifi: pcie: compare with number of IRQs requested for, not number of CPUs

AceLan Kao
From: Hao Wei Tee <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1805088

When there are 16 or more logical CPUs, we request for
`IWL_MAX_RX_HW_QUEUES` (16) IRQs only as we limit to that number of
IRQs, but later on we compare the number of IRQs returned to
nr_online_cpus+2 instead of max_irqs, the latter being what we
actually asked for. This ends up setting num_rx_queues to 17 which
causes lots of out-of-bounds array accesses later on.

Compare to max_irqs instead, and also add an assertion in case
num_rx_queues > IWM_MAX_RX_HW_QUEUES.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=199551

Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Hao Wei Tee <[hidden email]>
Tested-by: Sara Sharon <[hidden email]>
Signed-off-by: Luca Coelho <[hidden email]>
Signed-off-by: Kalle Valo <[hidden email]>
(cherry picked from commit ab1068d6866e28bf6427ceaea681a381e5870a4a)
Signed-off-by: AceLan Kao <[hidden email]>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index fbc45361f0bb..14a755cdaf36 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1588,14 +1588,13 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev *pdev,
  struct iwl_trans *trans)
 {
  struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
- int max_irqs, num_irqs, i, ret, nr_online_cpus;
+ int max_irqs, num_irqs, i, ret;
  u16 pci_cmd;
 
  if (!trans->cfg->mq_rx_supported)
  goto enable_msi;
 
- nr_online_cpus = num_online_cpus();
- max_irqs = min_t(u32, nr_online_cpus + 2, IWL_MAX_RX_HW_QUEUES);
+ max_irqs = min_t(u32, num_online_cpus() + 2, IWL_MAX_RX_HW_QUEUES);
  for (i = 0; i < max_irqs; i++)
  trans_pcie->msix_entries[i].entry = i;
 
@@ -1621,16 +1620,17 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev *pdev,
  * Two interrupts less: non rx causes shared with FBQ and RSS.
  * More than two interrupts: we will use fewer RSS queues.
  */
- if (num_irqs <= nr_online_cpus) {
+ if (num_irqs <= max_irqs - 2) {
  trans_pcie->trans->num_rx_queues = num_irqs + 1;
  trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX |
  IWL_SHARED_IRQ_FIRST_RSS;
- } else if (num_irqs == nr_online_cpus + 1) {
+ } else if (num_irqs == max_irqs - 1) {
  trans_pcie->trans->num_rx_queues = num_irqs;
  trans_pcie->shared_vec_mask = IWL_SHARED_IRQ_NON_RX;
  } else {
  trans_pcie->trans->num_rx_queues = num_irqs - 1;
  }
+ WARN_ON(trans_pcie->trans->num_rx_queues > IWL_MAX_RX_HW_QUEUES);
 
  trans_pcie->alloc_vecs = num_irqs;
  trans_pcie->msix_enabled = true;
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH 0/1][SRU][B][OEM-B]iwlwifi fails to work on 16 or more

Kai-Heng Feng
In reply to this post by AceLan Kao


> On Nov 26, 2018, at 4:22 PM, AceLan Kao <[hidden email]> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/1805088
>
> [Impact]
> Got dmesg kernel BUG while loading iwlwifi driver on machines
> which has 16 or more logical CPUs
>   kernel: RIP: 0010:iwl_pcie_rxq_alloc_rbs+0x1d0/0x1f0 [iwlwifi]
> And it leads to wifi can't scan any APs, and leads to system hangs
> while suspending.
>
> [Fix]
> Below commit contained in v4.17 fix the issue.
>   ab1068d6866e iwlwifi: pcie: compare with number of IRQs requested for,
>                not number of CPUs
>
> [Regression Potential]
> Low.
>
> [Misc]
> The commit is in v4.17, so ubuntu cosmic is safe.
> And ubuntu xenial is safe, too, since the commit which introduces this
> issue isn't contained in v4.4 kernel
>   2e5d4a8f61dc iwlwifi: pcie: Add new configuration to enable MSIX
>
> Hao Wei Tee (1):
>  iwlwifi: pcie: compare with number of IRQs requested for, not number
>    of CPUs
>
> drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)

Acked-by: Kai-Heng Feng <[hidden email]>

>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[OEM-B]: [PATCH 0/1][SRU][B][OEM-B]iwlwifi fails to work on 16 or more

AceLan Kao
In reply to this post by AceLan Kao
Applied on oem kernel 4.15.0-1029.34

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACKed: [PATCH 1/1][SRU][B][OEM-B]iwlwifi: pcie: compare with number of IRQs requested for, not number of CPUs

Aaron Ma
In reply to this post by AceLan Kao
Acked-by: Aaron Ma <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED/cmnt: [PATCH 0/1][SRU][B][OEM-B]iwlwifi fails to work on 16 or more

Khaled Elmously
In reply to this post by AceLan Kao
Actually, it was already APPLIED to bionic. It came in as part of https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1808185


On 2018-11-26 16:22:05 , AceLan Kao wrote:

> BugLink: https://bugs.launchpad.net/bugs/1805088
>
> [Impact]
> Got dmesg kernel BUG while loading iwlwifi driver on machines
> which has 16 or more logical CPUs
>    kernel: RIP: 0010:iwl_pcie_rxq_alloc_rbs+0x1d0/0x1f0 [iwlwifi]
> And it leads to wifi can't scan any APs, and leads to system hangs
> while suspending.
>
> [Fix]
> Below commit contained in v4.17 fix the issue.
>    ab1068d6866e iwlwifi: pcie: compare with number of IRQs requested for,
>                 not number of CPUs
>
> [Regression Potential]
> Low.
>
> [Misc]
> The commit is in v4.17, so ubuntu cosmic is safe.
> And ubuntu xenial is safe, too, since the commit which introduces this
> issue isn't contained in v4.4 kernel
>    2e5d4a8f61dc iwlwifi: pcie: Add new configuration to enable MSIX
>
> Hao Wei Tee (1):
>   iwlwifi: pcie: compare with number of IRQs requested for, not number
>     of CPUs
>
>  drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team