[PATCH net v2] octeontx2-af: cn10k: restrict VF LMTLINE sharing to its own PF

From: Junrui Luo

Date: Mon Jun 01 2026 - 02:02:48 EST


rvu_mbox_handler_lmtst_tbl_setup() uses req->base_pcifunc as a direct
index into the LMT map table to read another function's LMTLINE
physical base address and copy it into the caller's own LMT map table
entry. The mailbox dispatcher authenticates req->hdr.pcifunc from the
IRQ source, but req->base_pcifunc is a separate payload field and is
not sanitized.

Reject with -EPERM when a VF caller and the base function do not share a
parent PF. PF callers are trusted and may still share LMTLINEs across
PFs.

Fixes: 893ae97214c3 ("octeontx2-af: cn10k: Support configurable LMTST regions")
Reported-by: Yuhao Jiang <danisjiang@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Junrui Luo <moonafterrain@xxxxxxxxxxx>
---
Changes in v2:
- Restrict the check to VF callers only. PF callers are trusted and may
still share LMTLINEs across PFs.
- Link to v1: https://lore.kernel.org/r/SYBPR01MB7881F8D11D2930BB84215253AF0D2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
---
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
index d2163da28d18..33f25e2fc262 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
@@ -178,6 +178,14 @@ int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu,
* pcifunc (will be the one who is calling this mailbox).
*/
if (req->base_pcifunc) {
+ /* A VF is untrusted and must not redirect its LMTLINE to
+ * another PF's region, so confine VF callers to their own PF.
+ */
+ if (is_vf(req->hdr.pcifunc) &&
+ rvu_get_pf(rvu->pdev, req->hdr.pcifunc) !=
+ rvu_get_pf(rvu->pdev, req->base_pcifunc))
+ return -EPERM;
+
/* Calculating the LMT table index equivalent to primary
* pcifunc.
*/

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260601-fixes-a06620632bac

Best regards,
--
Junrui Luo <moonafterrain@xxxxxxxxxxx>