]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
enic: prevent waking up stopped tx queues over watchdog reset
authorFiro Yang <firo.yang@suse.com>
Wed, 12 Feb 2020 05:09:17 +0000 (06:09 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 24 Feb 2020 15:19:22 +0000 (16:19 +0100)
commit954a285468861174299ebc34d1e90d6e892a4862
tree7505a9b1e20f90b1141d0a600b090ee3c54f2cfc
parenta6ff027a58b7c824158a92a4b3b26456e0146755
enic: prevent waking up stopped tx queues over watchdog reset

BugLink: https://bugs.launchpad.net/bugs/1864488
[ Upstream commit 0f90522591fd09dd201065c53ebefdfe3c6b55cb ]

Recent months, our customer reported several kernel crashes all
preceding with following message:
NETDEV WATCHDOG: eth2 (enic): transmit queue 0 timed out
Error message of one of those crashes:
BUG: unable to handle kernel paging request at ffffffffa007e090

After analyzing severl vmcores, I found that most of crashes are
caused by memory corruption. And all the corrupted memory areas
are overwritten by data of network packets. Moreover, I also found
that the tx queues were enabled over watchdog reset.

After going through the source code, I found that in enic_stop(),
the tx queues stopped by netif_tx_disable() could be woken up over
a small time window between netif_tx_disable() and the
napi_disable() by the following code path:
napi_poll->
  enic_poll_msix_wq->
     vnic_cq_service->
        enic_wq_service->
           netif_wake_subqueue(enic->netdev, q_number)->
              test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)
In turn, upper netowrk stack could queue skb to ENIC NIC though
enic_hard_start_xmit(). And this might introduce some race condition.

Our customer comfirmed that this kind of kernel crash doesn't occur over
90 days since they applied this patch.

Signed-off-by: Firo Yang <firo.yang@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/cisco/enic/enic_main.c