All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Selwin Sebastian <selwin.sebastian@amd.com>,
	Amaranath Somalapuram <asomalap@amd.com>,
	Ravi Kumar <ravi1.kumar@amd.com>
Subject: [PATCH v3 4/4] net/axgbe: fix descriptor status out-of-bounds access
Date: Thu, 18 Jun 2026 10:21:59 -0700	[thread overview]
Message-ID: <20260618172544.338758-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20260618172544.338758-1-stephen@networkplumber.org>

Both axgbe_dev_rx_descriptor_status() and
axgbe_dev_tx_descriptor_status() compute the descriptor address as
desc[idx + offset] where idx is the masked ring position. When
idx + offset >= nb_desc, this reads past the end of the
descriptor ring buffer.

Fix by incorporating the offset into the index before masking,
using AXGBE_GET_DESC_IDX() which wraps with (nb_desc - 1).

Fixes: 0962b6055c08 ("net/axgbe: support descriptor status")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/axgbe/axgbe_rxtx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index 51a1aeb0b9..6f750d6ede 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -1205,8 +1205,8 @@ axgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
 	if (offset >= rxq->nb_desc - rxq->dirty)
 		return RTE_ETH_RX_DESC_UNAVAIL;
 
-	idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur);
-	desc = &rxq->desc[idx + offset];
+	idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur + offset);
+	desc = &rxq->desc[idx];
 
 	if (!AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3, OWN))
 		return RTE_ETH_RX_DESC_DONE;
@@ -1228,8 +1228,8 @@ axgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
 	if (offset >= txq->nb_desc - txq->dirty)
 		return RTE_ETH_TX_DESC_UNAVAIL;
 
-	idx = AXGBE_GET_DESC_IDX(txq, txq->dirty + txq->free_batch_cnt - 1);
-	desc = &txq->desc[idx + offset];
+	idx = AXGBE_GET_DESC_IDX(txq, txq->dirty + txq->free_batch_cnt - 1 + offset);
+	desc = &txq->desc[idx];
 
 	if (!AXGMAC_GET_BITS_LE(desc->desc3, TX_NORMAL_DESC3, OWN))
 		return RTE_ETH_TX_DESC_DONE;
-- 
2.53.0


      parent reply	other threads:[~2026-06-18 17:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18 16:40 [PATCH 0/4] net/axgbe: fix resource leaks and OOB access Stephen Hemminger
2026-02-18 16:40 ` [PATCH 1/4] net/axgbe: fix resource leaks in device init error paths Stephen Hemminger
2026-02-18 16:41 ` [PATCH 2/4] net/axgbe: fix Rx queue leak on descriptor init failure Stephen Hemminger
2026-04-05 16:11   ` Stephen Hemminger
2026-02-18 16:41 ` [PATCH 3/4] net/axgbe: destroy mutexes on device close Stephen Hemminger
2026-02-18 16:41 ` [PATCH 4/4] net/axgbe: fix descriptor status out-of-bounds access Stephen Hemminger
2026-02-20 17:50 ` [PATCH 0/4] net/axgbe: fix resource leaks and OOB access Stephen Hemminger
2026-02-25 16:52 ` Stephen Hemminger
2026-02-26 12:43   ` Sebastian, Selwin
2026-03-06 18:55 ` Stephen Hemminger
2026-03-08 16:53   ` Ande, Venkat Kumar
2026-03-11 10:53   ` Sebastian, Selwin
2026-05-08 19:10 ` [PATCH v2 " Stephen Hemminger
2026-05-08 19:10   ` [PATCH v2 1/4] net/axgbe: fix resource leaks in device init error paths Stephen Hemminger
2026-05-08 19:10   ` [PATCH v2 2/4] net/axgbe: fix Rx queue leak on descriptor init failure Stephen Hemminger
2026-05-08 19:10   ` [PATCH v2 3/4] net/axgbe: destroy mutexes on device close Stephen Hemminger
2026-05-08 19:10   ` [PATCH v2 4/4] net/axgbe: fix descriptor status out-of-bounds access Stephen Hemminger
2026-06-18 17:21 ` [PATCH v3 0/4] net/axgbe: fix resource leaks and OOB access Stephen Hemminger
2026-06-18 17:21   ` [PATCH v3 1/4] net/axgbe: fix resource leaks in device init error paths Stephen Hemminger
2026-06-18 17:21   ` [PATCH v3 2/4] net/axgbe: fix Rx queue leak on descriptor init failure Stephen Hemminger
2026-06-18 17:21   ` [PATCH v3 3/4] net/axgbe: destroy mutexes on device close Stephen Hemminger
2026-06-18 17:21   ` Stephen Hemminger [this message]

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=20260618172544.338758-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=asomalap@amd.com \
    --cc=dev@dpdk.org \
    --cc=ravi1.kumar@amd.com \
    --cc=selwin.sebastian@amd.com \
    --cc=stable@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.