]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
net: ena: don't wake up tx queue when down
authorSameeh Jubran <sameehj@amazon.com>
Sun, 15 Sep 2019 14:29:44 +0000 (17:29 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 13 Nov 2019 16:59:36 +0000 (17:59 +0100)
commit1532af92c368c3fa29d6f78383474bd225705915
treeb8e2d016a38b455ba611b695ec2870311db82d3c
parent96117aeec4b0517bb5275c1f3aa5c2fed02a9cc8
net: ena: don't wake up tx queue when down

BugLink: https://bugs.launchpad.net/bugs/1850175
There is a race condition that can occur when calling ena_down().
The ena_clean_tx_irq() - which is a part of the napi handler -
function might wake up the tx queue when the queue is supposed
to be down (during recovery or changing the size of the queues
for example) This causes the ena_start_xmit() function to trigger
and possibly try to access the destroyed queues.

The race is illustrated below:

Flow A:                                       Flow B(napi handler)
ena_down()
   netif_carrier_off()
   netif_tx_disable()
                                                      ena_clean_tx_irq()
                                                         netif_tx_wake_queue()
   ena_napi_disable_all()
   ena_destroy_all_io_queues()

After these flows the tx queue is active and ena_start_xmit() accesses
the destroyed queue which leads to a kernel panic.

fixes: 1738cd3ed342 (net: ena: Add a driver for Amazon Elastic Network Adapters (ENA))

Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a53651ec93a8d7ab5b26c5390e0c389048b4b4b6)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Khaled Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/amazon/ena/ena_netdev.c