FAILED: patch "[PATCH] octeontx2-af: Add array index check" 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 ef15ddeeb6bee87c044bf7754fac524545bf71e8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024040558-trustee-garage-e392@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ef15ddeeb6bee87c044bf7754fac524545bf71e8 Mon Sep 17 00:00:00 2001
From: Aleksandr Mishin <[email protected]>
Date: Thu, 28 Mar 2024 19:55:05 +0300
Subject: [PATCH] octeontx2-af: Add array index check
In rvu_map_cgx_lmac_pf() the 'iter', which is used as an array index, can reach value (up to 14) that exceed the size (MAX_LMAC_COUNT = 8) of the array. Fix this bug by adding 'iter' value check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +2 -0
@@ -160,6 +160,8 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu)continue ; lmac_bmap =cgx_get_lmac_bmap (rvu_cgx_pdata (cgx, rvu));for_each_set_bit (iter, &lmac_bmap, rvu->hw->lmac_per_cgx) { +if (iter >=MAX_LMAC_COUNT ) +continue ; lmac =cgx_get_lmacid (rvu_cgx_pdata (cgx, rvu), iter); rvu->pf2cgxlmac_map[pf] =cgxlmac_id_to_bmap (cgx, lmac);