net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
authorMaher Azzouzi <maherazz04@gmail.com>
Sat, 2 Aug 2025 00:18:57 +0000 (17:18 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 5 Aug 2025 00:22:20 +0000 (17:22 -0700)
commitffd2dc4c6c49ff4f1e5d34e454a6a55608104c17
treed7f497ed145936acf1fcde7024a55f080ccf22fe
parent175811b8f05f0da3e19b7d3124666649ddde3802
net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing

TCA_MQPRIO_TC_ENTRY_INDEX is validated using
NLA_POLICY_MAX(NLA_U32, TC_QOPT_MAX_QUEUE), which allows the value
TC_QOPT_MAX_QUEUE (16). This leads to a 4-byte out-of-bounds stack
write in the fp[] array, which only has room for 16 elements (0–15).

Fix this by changing the policy to allow only up to TC_QOPT_MAX_QUEUE - 1.

Fixes: f62af20bed2d ("net/sched: mqprio: allow per-TC user input of FP adminStatus")
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Maher Azzouzi <maherazz04@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20250802001857.2702497-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/sch_mqprio.c