mirror-linux/drivers/net/ethernet/marvell/octeontx2/af
Michael Bommarito 2156a29aec octeontx2-af: validate body pcifunc in rvu_mbox_handler_rep_event_notify
rvu_mbox_handler_rep_event_notify() in drivers/net/ethernet/marvell/
octeontx2/af/rvu_rep.c queues a sender-controlled REP_EVENT_NOTIFY
request body verbatim, and rvu_rep_up_notify() then forwards
event->pcifunc (the nested body field, distinct from the
AF-normalised header pcifunc) into rvu_get_pfvf(), rvu_get_pf() and
the AF->PF mailbox device index without any bounds check.

A VF attached to a PF that has been put into switchdev
representor mode reaches this path: the VF mailbox handler
otx2_pfvf_mbox_handler() forwards every message id including
MBOX_MSG_REP_EVENT_NOTIFY to AF without an allowlist, and the AF
dispatcher rewrites only msg->pcifunc, leaving struct
rep_event::pcifunc attacker-controlled.  The sibling
rvu_mbox_handler_esw_cfg() refuses requests whose header pcifunc
is not rvu->rep_pcifunc; this handler has no equivalent gate.

An out-of-range body pcifunc selects an &rvu->pf[]/&rvu->hwvf[]
element past the allocated array and, for RVU_EVENT_MAC_ADDR_CHANGE,
turns into a six-byte attacker-chosen OOB ether_addr_copy() target
inside the queued worker; KASAN reports a slab-out-of-bounds write
in rvu_rep_wq_handler.

Reject malformed requests at the handler entry by gating on
is_pf_func_valid(), which is already the canonical PF/VF range check
in this driver; expose it via rvu.h so callers in rvu_rep.c can use
it instead of open-coding the same range arithmetic.

Fixes: b8fea84a04 ("octeontx2-pf: Add support to sync link state between representor and VFs")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Link: https://patch.msgid.link/20260520154157.1439319-1-michael.bommarito@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-25 12:49:33 -07:00
..
cn20k octeontx2-af: npc: cn20k: Reject missing default-rule MCAM indices 2026-04-30 18:50:17 -07:00
Makefile octeontx2-af: npc: cn20k: Index management 2026-02-28 10:29:25 -08:00
cgx.c octeontx2-af: CGX: add bounds check to cgx_speed_mbps index 2026-05-15 17:22:43 -07:00
cgx.h octeontx2-af: Remove unused declarations 2025-08-26 09:25:44 +02:00
cgx_fw_if.h
common.h octeontx2-af: npc: cn20k: Index management 2026-02-28 10:29:25 -08:00
lmac_common.h
mbox.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mbox.h octeontx2-af: npc: Use common structures 2026-02-28 10:29:27 -08:00
mcs.c
mcs.h
mcs_cnf10kb.c
mcs_reg.h
mcs_rvu_if.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
npc.h octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon 2026-02-28 10:29:26 -08:00
npc_profile.h octeontx2-af: npc: cn20k: MKEX profile support 2026-02-28 10:29:25 -08:00
ptp.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ptp.h
rpm.c
rpm.h
rvu.c octeontx2-af: validate body pcifunc in rvu_mbox_handler_rep_event_notify 2026-05-25 12:49:33 -07:00
rvu.h octeontx2-af: validate body pcifunc in rvu_mbox_handler_rep_event_notify 2026-05-25 12:49:33 -07:00
rvu_cgx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rvu_cn10k.c net: Fix typos 2025-07-25 10:29:07 -07:00
rvu_cpt.c
rvu_debugfs.c octeontx2-af: simplify rvu_debugfs 2026-03-24 11:08:17 +01:00
rvu_devlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-03-12 12:53:34 -07:00
rvu_devlink.h
rvu_nix.c octeontx2-af: npc: cn20k: Reject missing default-rule MCAM indices 2026-04-30 18:50:17 -07:00
rvu_npa.c octeontx2-af: Skip NDC operations for cn20k 2025-10-30 10:44:09 +01:00
rvu_npc.c octeontx2-af: npc: Fix allmulticast skip logic for LBK and SDP VFs 2026-05-21 08:12:59 -07:00
rvu_npc.h octeontx2-af: npc: cn20k: virtual index support 2026-02-28 10:29:26 -08:00
rvu_npc_fs.c octeontx2-af: npc: cn20k: Reject missing default-rule MCAM indices 2026-04-30 18:50:17 -07:00
rvu_npc_fs.h octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation 2026-02-28 10:29:26 -08:00
rvu_npc_hash.c octeontx2-af: npc: cn20k: Prepare for new SoC 2026-02-28 10:29:26 -08:00
rvu_npc_hash.h octeontx2-af: npc: cn20k: Prepare for new SoC 2026-02-28 10:29:26 -08:00
rvu_reg.c
rvu_reg.h
rvu_rep.c octeontx2-af: validate body pcifunc in rvu_mbox_handler_rep_event_notify 2026-05-25 12:49:33 -07:00
rvu_sdp.c Octeontx2-af: Add proper checks for fwdata 2026-01-22 08:09:00 -08:00
rvu_struct.h octeontx2-af: Accommodate more bandwidth profiles for cn20k 2025-10-30 10:44:09 +01:00
rvu_switch.c
rvu_trace.c
rvu_trace.h