* [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver
@ 2018-10-09 8:21 akiyano
2018-10-09 8:21 ` [PATCH V2 net 1/4] net: ena: fix warning in rmmod caused by double iounmap akiyano
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: akiyano @ 2018-10-09 8:21 UTC (permalink / raw)
To: davem, netdev
Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
nafea, gtzalik, netanel, alisaidi
From: Arthur Kiyanovski <akiyano@amazon.com>
Arthur Kiyanovski (4):
net: ena: fix warning in rmmod caused by double iounmap
net: ena: fix rare bug when failed restart/resume is followed by
driver removal
net: ena: fix NULL dereference due to untimely napi initialization
net: ena: fix auto casting to boolean
drivers/net/ethernet/amazon/ena/ena_eth_com.c | 8 ++++----
drivers/net/ethernet/amazon/ena/ena_netdev.c | 22 ++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 net 1/4] net: ena: fix warning in rmmod caused by double iounmap
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
@ 2018-10-09 8:21 ` akiyano
2018-10-09 8:21 ` [PATCH V2 net 2/4] net: ena: fix rare bug when failed restart/resume is followed by driver removal akiyano
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: akiyano @ 2018-10-09 8:21 UTC (permalink / raw)
To: davem, netdev
Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
nafea, gtzalik, netanel, alisaidi
From: Arthur Kiyanovski <akiyano@amazon.com>
Memory mapped with devm_ioremap is automatically freed when the driver
is disconnected from the device. Therefore there is no need to
explicitly call devm_iounmap.
Fixes: 0857d92f71b6 ("net: ena: add missing unmap bars on device removal")
Fixes: 411838e7b41c ("net: ena: fix rare kernel crash when bar memory remap fails")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 25621a2..78d84ca 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -3099,15 +3099,8 @@ static int ena_rss_init_default(struct ena_adapter *adapter)
static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev)
{
- int release_bars;
+ int release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
- if (ena_dev->mem_bar)
- devm_iounmap(&pdev->dev, ena_dev->mem_bar);
-
- if (ena_dev->reg_bar)
- devm_iounmap(&pdev->dev, ena_dev->reg_bar);
-
- release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
pci_release_selected_regions(pdev, release_bars);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 net 2/4] net: ena: fix rare bug when failed restart/resume is followed by driver removal
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
2018-10-09 8:21 ` [PATCH V2 net 1/4] net: ena: fix warning in rmmod caused by double iounmap akiyano
@ 2018-10-09 8:21 ` akiyano
2018-10-09 8:21 ` [PATCH V2 net 3/4] net: ena: fix NULL dereference due to untimely napi initialization akiyano
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: akiyano @ 2018-10-09 8:21 UTC (permalink / raw)
To: davem, netdev
Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
nafea, gtzalik, netanel, alisaidi
From: Arthur Kiyanovski <akiyano@amazon.com>
In a rare scenario when ena_device_restore() fails, followed by device
remove, an FLR will not be issued. In this case, the device will keep
sending asynchronous AENQ keep-alive events, even after driver removal,
leading to memory corruption.
Fixes: 8c5c7abdeb2d ("net: ena: add power management ops to the ENA driver")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 78d84ca..ce18e07 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2619,7 +2619,11 @@ static int ena_restore_device(struct ena_adapter *adapter)
ena_free_mgmnt_irq(adapter);
ena_disable_msix(adapter);
err_device_destroy:
+ ena_com_abort_admin_commands(ena_dev);
+ ena_com_wait_for_abort_completion(ena_dev);
ena_com_admin_destroy(ena_dev);
+ ena_com_mmio_reg_read_request_destroy(ena_dev);
+ ena_com_dev_reset(ena_dev, ENA_REGS_RESET_DRIVER_INVALID_STATE);
err:
clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 net 3/4] net: ena: fix NULL dereference due to untimely napi initialization
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
2018-10-09 8:21 ` [PATCH V2 net 1/4] net: ena: fix warning in rmmod caused by double iounmap akiyano
2018-10-09 8:21 ` [PATCH V2 net 2/4] net: ena: fix rare bug when failed restart/resume is followed by driver removal akiyano
@ 2018-10-09 8:21 ` akiyano
2018-10-09 8:21 ` [PATCH V2 net 4/4] net: ena: fix auto casting to boolean akiyano
2018-10-09 17:50 ` [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver David Miller
4 siblings, 0 replies; 6+ messages in thread
From: akiyano @ 2018-10-09 8:21 UTC (permalink / raw)
To: davem, netdev
Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
nafea, gtzalik, netanel, alisaidi
From: Arthur Kiyanovski <akiyano@amazon.com>
napi poll functions should be initialized before running request_irq(),
to handle a rare condition where there is a pending interrupt, causing
the ISR to fire immediately while the poll function wasn't set yet,
causing a NULL dereference.
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index ce18e07..d906293 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1575,8 +1575,6 @@ static int ena_up_complete(struct ena_adapter *adapter)
if (rc)
return rc;
- ena_init_napi(adapter);
-
ena_change_mtu(adapter->netdev, adapter->netdev->mtu);
ena_refill_all_rx_bufs(adapter);
@@ -1730,6 +1728,13 @@ static int ena_up(struct ena_adapter *adapter)
ena_setup_io_intr(adapter);
+ /* napi poll functions should be initialized before running
+ * request_irq(), to handle a rare condition where there is a pending
+ * interrupt, causing the ISR to fire immediately while the poll
+ * function wasn't set yet, causing a null dereference
+ */
+ ena_init_napi(adapter);
+
rc = ena_request_io_irq(adapter);
if (rc)
goto err_req_irq;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 net 4/4] net: ena: fix auto casting to boolean
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
` (2 preceding siblings ...)
2018-10-09 8:21 ` [PATCH V2 net 3/4] net: ena: fix NULL dereference due to untimely napi initialization akiyano
@ 2018-10-09 8:21 ` akiyano
2018-10-09 17:50 ` [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver David Miller
4 siblings, 0 replies; 6+ messages in thread
From: akiyano @ 2018-10-09 8:21 UTC (permalink / raw)
To: davem, netdev
Cc: Arthur Kiyanovski, dwmw, zorik, matua, saeedb, msw, aliguori,
nafea, gtzalik, netanel, alisaidi
From: Arthur Kiyanovski <akiyano@amazon.com>
Eliminate potential auto casting compilation error.
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
---
drivers/net/ethernet/amazon/ena/ena_eth_com.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.c b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
index 1c682b7..2b3ff0c 100644
--- a/drivers/net/ethernet/amazon/ena/ena_eth_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
@@ -245,11 +245,11 @@ static inline void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx,
(cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_MASK) >>
ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_SHIFT;
ena_rx_ctx->l3_csum_err =
- (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_MASK) >>
- ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_SHIFT;
+ !!((cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_MASK) >>
+ ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_SHIFT);
ena_rx_ctx->l4_csum_err =
- (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_MASK) >>
- ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_SHIFT;
+ !!((cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_MASK) >>
+ ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_SHIFT);
ena_rx_ctx->hash = cdesc->hash;
ena_rx_ctx->frag =
(cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_MASK) >>
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
` (3 preceding siblings ...)
2018-10-09 8:21 ` [PATCH V2 net 4/4] net: ena: fix auto casting to boolean akiyano
@ 2018-10-09 17:50 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-10-09 17:50 UTC (permalink / raw)
To: akiyano
Cc: netdev, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
gtzalik, netanel, alisaidi
From: <akiyano@amazon.com>
Date: Tue, 9 Oct 2018 11:21:26 +0300
> From: Arthur Kiyanovski <akiyano@amazon.com>
>
> Arthur Kiyanovski (4):
> net: ena: fix warning in rmmod caused by double iounmap
> net: ena: fix rare bug when failed restart/resume is followed by
> driver removal
> net: ena: fix NULL dereference due to untimely napi initialization
> net: ena: fix auto casting to boolean
Series applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-10-10 1:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 8:21 [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver akiyano
2018-10-09 8:21 ` [PATCH V2 net 1/4] net: ena: fix warning in rmmod caused by double iounmap akiyano
2018-10-09 8:21 ` [PATCH V2 net 2/4] net: ena: fix rare bug when failed restart/resume is followed by driver removal akiyano
2018-10-09 8:21 ` [PATCH V2 net 3/4] net: ena: fix NULL dereference due to untimely napi initialization akiyano
2018-10-09 8:21 ` [PATCH V2 net 4/4] net: ena: fix auto casting to boolean akiyano
2018-10-09 17:50 ` [PATCH V2 net 0/4] minor bug fixes for ENA Ethernet driver David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).