From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
danielx.t.mrzyglod@intel.com, stable@dpdk.org,
Chaoyong He <chaoyong.he@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 2/3] net/bonding: fix illegal memory accesses
Date: Tue, 10 Oct 2023 14:23:03 +0800 [thread overview]
Message-ID: <20231010062304.205933-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231010062304.205933-1-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
CI found that overrunning array of 32 2-byte elements at
element index 65535 (byte offset 131071) by dereferencing
pointer "members + agg_new_idx".
Coverity issue: 403099
Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes")
Cc: danielx.t.mrzyglod@intel.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/bonding/rte_eth_bond_8023ad.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 677067870f..0be33f61e3 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -732,10 +732,14 @@ selection_logic(struct bond_dev_private *internals, uint16_t member_id)
switch (internals->mode4.agg_selection) {
case AGG_COUNT:
agg_new_idx = max_index(agg_count, members_count);
+ if (agg_new_idx >= members_count)
+ agg_new_idx = default_member;
new_agg_id = members[agg_new_idx];
break;
case AGG_BANDWIDTH:
agg_new_idx = max_index(agg_bandwidth, members_count);
+ if (agg_new_idx >= members_count)
+ agg_new_idx = default_member;
new_agg_id = members[agg_new_idx];
break;
case AGG_STABLE:
--
2.39.1
next prev parent reply other threads:[~2023-10-10 6:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20231010062304.205933-1-chaoyong.he@corigine.com>
2023-10-10 6:23 ` [PATCH 1/3] app/test: fix control flow issue Chaoyong He
2023-10-31 14:51 ` Ferruh Yigit
2023-10-10 6:23 ` Chaoyong He [this message]
2023-10-31 14:51 ` [PATCH 2/3] net/bonding: fix illegal memory accesses Ferruh Yigit
2023-11-01 2:19 ` [PATCH v2] " Chaoyong He
2023-11-01 15:38 ` Ferruh Yigit
2023-10-10 6:23 ` [PATCH 3/3] app/test: fix checking return value Chaoyong He
2023-10-31 14:52 ` Ferruh Yigit
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=20231010062304.205933-3-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=danielx.t.mrzyglod@intel.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.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;
as well as URLs for NNTP newsgroup(s).