From: Sergei Iashin <yashin.sergey@gmail.com>
To: Harman Kalra <hkalra@marvell.com>,
Santosh Shukla <santosh.shukla@caviumnetworks.com>,
Jerin Jacob <jerinj@marvell.com>
Cc: dev@dpdk.org, stable@dpdk.org, jerin.jacob@caviumnetworks.com,
Sergei Iashin <yashin.sergey@gmail.com>
Subject: [PATCH] net/octeontx/base: fix out-of-bounds read in DQ range lookup
Date: Tue, 7 Apr 2026 14:30:01 +0300 [thread overview]
Message-ID: <20260407113001.1217481-1-yashin.sergey@gmail.com> (raw)
In octeontx_pko_dq_range_lookup(), the inner while loop evaluates the
array access ctl->dq_map[dq].chanid before the bounds check
dq < RTE_DIM(ctl->dq_map). When dq is incremented to 256 inside the
loop, the next iteration reads one element past the end of the
256-element dq_map array before the bounds condition can short-circuit.
Swap the two conjuncts so the bounds check is evaluated first, matching
the pattern already used in the outer loop.
Fixes: cad78ca23818 ("net/octeontx/base: add base PKO operations")
Cc: jerin.jacob@caviumnetworks.com
Cc: stable@dpdk.org
Signed-off-by: Sergei Iashin <yashin.sergey@gmail.com>
---
drivers/net/octeontx/base/octeontx_pkovf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index 7aec84a813..5326fe24b9 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -196,8 +196,8 @@ octeontx_pko_dq_range_lookup(struct octeontx_pko_vf_ctl_s *ctl, uint64_t chanid,
while (dq < RTE_DIM(ctl->dq_map)) {
dq_base = dq;
dq_cnt = 0;
- while (ctl->dq_map[dq].chanid == ~chanid &&
- dq < RTE_DIM(ctl->dq_map)) {
+ while (dq < RTE_DIM(ctl->dq_map) &&
+ ctl->dq_map[dq].chanid == ~chanid) {
dq_cnt++;
if (dq_cnt == dq_num)
return dq_base;
--
2.39.5
reply other threads:[~2026-04-08 8:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260407113001.1217481-1-yashin.sergey@gmail.com \
--to=yashin.sergey@gmail.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--cc=jerin.jacob@caviumnetworks.com \
--cc=jerinj@marvell.com \
--cc=santosh.shukla@caviumnetworks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox