FAILED: patch "[PATCH] octeontx2-af: CGX: add bounds check to cgx_speed_mbps index" failed to apply to 5.15-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x c0bf0a4f3f1f5f57aa83e1400ba4f56f0abfd542
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026052832-gigahertz-crumb-cbe0@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c0bf0a4f3f1f5f57aa83e1400ba4f56f0abfd542 Mon Sep 17 00:00:00 2001
From: Sam Daly <[email protected]>
Date: Wed, 13 May 2026 18:42:53 +0200
Subject: [PATCH] octeontx2-af: CGX: add bounds check to cgx_speed_mbps index
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
cgx_speed_mbps has 13 elements but RESP_LINKSTAT_SPEED can yield values 0-15. If it returns a value >= 13, this causes an out-of-bounds array access. Add a bounds check and default to speed 0 if the index is out of range.
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +6 -1
@@ -1294,13 +1294,18 @@ static inline void link_status_user_format(u64 lstat,struct cgx_link_user_info *linfo, struct cgx *cgx, u8 lmac_id) { + unsigned int speed; + linfo->link_up =FIELD_GET (RESP_LINKSTAT_UP , lstat); linfo->full_duplex =FIELD_GET (RESP_LINKSTAT_FDUPLEX , lstat); - linfo->speed = cgx_speed_mbps[FIELD_GET (RESP_LINKSTAT_SPEED , lstat)]; linfo->an =FIELD_GET (RESP_LINKSTAT_AN , lstat); linfo->fec =FIELD_GET (RESP_LINKSTAT_FEC , lstat); linfo->lmac_type_id =FIELD_GET (RESP_LINKSTAT_LMAC_TYPE , lstat); + speed =FIELD_GET (RESP_LINKSTAT_SPEED , lstat); + linfo->speed = speed <ARRAY_SIZE (cgx_speed_mbps) ? + cgx_speed_mbps[speed] :0 ; +if (linfo->lmac_type_id >=LMAC_MODE_MAX ) {dev_err (&cgx->pdev->dev,"Unknown lmac_type_id %d reported by firmware on cgx port%d:%d" , linfo->lmac_type_id, cgx->cgx_id, lmac_id);
Sasha Levin
maintainerPATCH 1/1 octeontx2-af: CGX: add bounds check to cgx_speed_mbps index
From: Sam Daly <[email protected]>
[ Upstream commit c0bf0a4f3f1f5f57aa83e1400ba4f56f0abfd542 ]
cgx_speed_mbps has 13 elements but RESP_LINKSTAT_SPEED can yield values 0-15. If it returns a value >= 13, this causes an out-of-bounds array access. Add a bounds check and default to speed 0 if the index is out of range.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +4 -1
@@ -1096,10 +1096,13 @@ static inline void link_status_user_format(u64 lstat, struct cgx *cgx, u8 lmac_id) {const char *lmac_string; +unsigned int speed; linfo->link_up =FIELD_GET (RESP_LINKSTAT_UP , lstat); linfo->full_duplex =FIELD_GET (RESP_LINKSTAT_FDUPLEX , lstat); - linfo->speed = cgx_speed_mbps[FIELD_GET (RESP_LINKSTAT_SPEED , lstat)]; + speed =FIELD_GET (RESP_LINKSTAT_SPEED , lstat); + linfo->speed = speed <ARRAY_SIZE (cgx_speed_mbps) ? + cgx_speed_mbps[speed] :0 ; linfo->an =FIELD_GET (RESP_LINKSTAT_AN , lstat); linfo->fec =FIELD_GET (RESP_LINKSTAT_FEC , lstat); linfo->lmac_type_id =cgx_get_lmac_type (cgx, lmac_id);
Signature · 1 line
2.53.0