* [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
@ 2025-08-02 0:18 Jakub Kicinski
2025-08-04 10:35 ` Vladimir Oltean
2025-08-05 0:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-08-02 0:18 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Maher Azzouzi,
Jakub Kicinski, jhs, xiyou.wangcong, jiri, vladimir.oltean, fejes
From: Maher Azzouzi <maherazz04@gmail.com>
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>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v3: repost for Maher, email problems..
v2: https://lore.kernel.org/CAFQ-Uc-5ucm+Dyt2s4vV5AyJKjamF=7E_wCWFROYubR5E1PMUg@mail.gmail.com
v2: https://lore.kernel.org/CANn89iJNKR8uBNrRCdqs-M6RspvgSK9+vxzfvXe3xUvDT538Lw@mail.gmail.com
v1: https://lore.kernel.org/20250722155121.440969-1-maherazz04@gmail.com
CC: jhs@mojatatu.com
CC: xiyou.wangcong@gmail.com
CC: jiri@resnulli.us
CC: vladimir.oltean@nxp.com
CC: fejes@inf.elte.hu
---
net/sched/sch_mqprio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 51d4013b6121..f3e5ef9a9592 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -152,7 +152,7 @@ static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt,
static const struct
nla_policy mqprio_tc_entry_policy[TCA_MQPRIO_TC_ENTRY_MAX + 1] = {
[TCA_MQPRIO_TC_ENTRY_INDEX] = NLA_POLICY_MAX(NLA_U32,
- TC_QOPT_MAX_QUEUE),
+ TC_QOPT_MAX_QUEUE - 1),
[TCA_MQPRIO_TC_ENTRY_FP] = NLA_POLICY_RANGE(NLA_U32,
TC_FP_EXPRESS,
TC_FP_PREEMPTIBLE),
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
2025-08-02 0:18 [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing Jakub Kicinski
@ 2025-08-04 10:35 ` Vladimir Oltean
2025-08-05 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2025-08-04 10:35 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
Maher Azzouzi, jhs, xiyou.wangcong, jiri, fejes
On Fri, Aug 01, 2025 at 05:18:57PM -0700, Jakub Kicinski wrote:
> From: Maher Azzouzi <maherazz04@gmail.com>
>
> 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>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v3: repost for Maher, email problems..
> v2: https://lore.kernel.org/CAFQ-Uc-5ucm+Dyt2s4vV5AyJKjamF=7E_wCWFROYubR5E1PMUg@mail.gmail.com
> v2: https://lore.kernel.org/CANn89iJNKR8uBNrRCdqs-M6RspvgSK9+vxzfvXe3xUvDT538Lw@mail.gmail.com
> v1: https://lore.kernel.org/20250722155121.440969-1-maherazz04@gmail.com
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
[not found] <4a000ef11bb148fa8955385155714056@DB9PR10MB6740.EURPRD10.PROD.OUTLOOK.COM>
@ 2025-08-04 12:32 ` Fejes Ferenc
0 siblings, 0 replies; 4+ messages in thread
From: Fejes Ferenc @ 2025-08-04 12:32 UTC (permalink / raw)
To: Jakub Kicinski, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, Maher Azzouzi,
jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
vladimir.oltean@nxp.com
On Sat, 2025-08-02 at 00:18 +0000, Jakub Kicinski wrote:
> From: Maher Azzouzi <maherazz04@gmail.com>
>
> 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>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
LGTM!
Reviewed-by: Ferenc Fejes <fejes@inf.elte.hu>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
2025-08-02 0:18 [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing Jakub Kicinski
2025-08-04 10:35 ` Vladimir Oltean
@ 2025-08-05 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-05 0:30 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, maherazz04,
jhs, xiyou.wangcong, jiri, vladimir.oltean, fejes
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 1 Aug 2025 17:18:57 -0700 you wrote:
> From: Maher Azzouzi <maherazz04@gmail.com>
>
> 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).
>
> [...]
Here is the summary with links:
- [net,v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
https://git.kernel.org/netdev/net/c/ffd2dc4c6c49
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-05 0:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-02 0:18 [PATCH net v3] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing Jakub Kicinski
2025-08-04 10:35 ` Vladimir Oltean
2025-08-05 0:30 ` patchwork-bot+netdevbpf
[not found] <4a000ef11bb148fa8955385155714056@DB9PR10MB6740.EURPRD10.PROD.OUTLOOK.COM>
2025-08-04 12:32 ` Fejes Ferenc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).