net: ena: fix: Free napi resources when ena_up() fails
authorSameeh Jubran <sameehj@amazon.com>
Wed, 1 May 2019 13:47:05 +0000 (16:47 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 May 2019 04:14:46 +0000 (00:14 -0400)
ena_up() calls ena_init_napi() but does not call ena_del_napi() in
case of failure. This causes a segmentation fault upon rmmod when
netif_napi_del() is called. Fix this bug by calling ena_del_napi()
before returning error from ena_up().

Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c

index dbcd58ebd0a90c7daec933e7a7f71f0bb6bc9973..03244155f74cbb86b2fec4d4d6b21fcb69b4f8fc 100644 (file)
@@ -1825,6 +1825,7 @@ err_setup_rx:
 err_setup_tx:
        ena_free_io_irq(adapter);
 err_req_irq:
+       ena_del_napi(adapter);
 
        return rc;
 }