From: Avi Weiss <thnkslprpt@gmail.com>
To: Arthur Kiyanovski <akiyano@amazon.com>,
David Arinzon <darinzon@amazon.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net] net: ena: avoid double-counting TX DMA mappings on failure
Date: Mon, 9 Nov 2026 14:39:34 +0200 [thread overview]
Message-ID: <20261109123934.824610-2-thnkslprpt@gmail.com> (raw)
ena_tx_map_skb() increments tx_info->num_of_bufs after each successful
DMA mapping. If a later fragment mapping fails, the error path adds the
fragment index to this count before calling ena_unmap_tx_buff(). This
can cause DMA unmapping of buffers that were never mapped and
out-of-bounds access to the buffer array.
Remove the extra increment so that cleanup uses only the number of
successfully mapped buffers.
Discovered by comparing the in-tree ENA driver with Amazon's standalone
ENA driver.
Compiled with W=1 under x86_64 defconfig and allmodconfig configurations.
Fixes: 38005ca816a7 ("net: ena: add functions for handling Low Latency Queues in ena_netdev")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
Already fixed in Amazon's standalone ENA driver:
https://github.com/amzn/amzn-drivers/commit/1d6a78cebd2d7c38b4dbdee572ab3d3755086248
drivers/net/ethernet/amazon/ena/ena_netdev.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 7eb6456ed0d5..e0df628e1df6 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2608,7 +2608,6 @@ static int ena_tx_map_skb(struct ena_ring *tx_ring,
tx_info->skb = NULL;
- tx_info->num_of_bufs += i;
ena_unmap_tx_buff(tx_ring, tx_info);
return -EINVAL;
base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
--
2.43.0
next reply other threads:[~2026-11-09 12:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 12:39 Avi Weiss [this message]
2026-11-09 12:41 ` [PATCH net] net: ena: avoid double-counting TX DMA mappings on failure netdev-bot+sinfo
2026-11-11 23:39 ` Arthur Kiyanovski
2026-11-12 1:11 ` Jakub Kicinski
2026-11-12 1:30 ` Kiyanovski, Arthur
2026-11-12 2:26 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109123934.824610-2-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=akiyano@amazon.com \
--cc=andrew+netdev@lunn.ch \
--cc=darinzon@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox