Skip to contentSkip to conversation

net: atm: reject out-of-range traffic classes in QoS validation

PATCH Applied Ren Wei 3 participants 3 messages Jun 9 – Jun 12 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Ren Wei

author
#1 lore raw

PATCH 1/1 net: atm: reject out-of-range traffic classes in QoS validation

In reply to a message not in the archive

From: Zhengchuan Liang <[email protected]>

Reject ATM traffic classes above ATM_ANYCLASS in check_tp(). SO_ATMQOS stores the supplied QoS after check_qos() succeeds, so accepting larger values leaves invalid traffic_class values in vcc->qos.

That bad state later reaches pvc_info(), which indexes class_name[] with vcc->qos.{rx,tp}.traffic_class. Values above ATM_ANYCLASS cause an out-of-bounds read when /proc/net/atm/pvc is read.

Tighten the existing QoS validation so invalid traffic_class values are rejected at the point where user supplied QoS is accepted.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by Codex:GPT-5.4
---
 net/atm/common.c | 2 ++
 1 file changed, 2 insertions(+)
net/atm/common.c +2 -0
index fe77f51f6ce1..6eb78c34c284 100644
@@ -720,6 +720,8 @@ static int atm_change_qos(struct atm_vcc *vcc, struct atm_qos *qos)
 static int check_tp(const struct atm_trafprm *tp)
 {
 	/* @@@ Should be merged with adjust_tp */
+	if (tp->traffic_class > ATM_ANYCLASS)
+		return -EINVAL;
 	if (!tp->traffic_class || tp->traffic_class == ATM_ANYCLASS)
 		return 0;
 	if (tp->traffic_class != ATM_UBR && !tp->min_pcr && !tp->pcr &&
Signature · 1 line
2.47.3
reviewer Reviewed-by on v1 1/1
#2 lore raw
Quoted 14 lines · Ren Wei

From: Zhengchuan Liang <[email protected]>

Reject ATM traffic classes above ATM_ANYCLASS in check_tp(). SO_ATMQOS stores the supplied QoS after check_qos() succeeds, so accepting larger values leaves invalid traffic_class values in vcc->qos.

That bad state later reaches pvc_info(), which indexes class_name[] with vcc->qos.{rx,tp}.traffic_class. Values above ATM_ANYCLASS cause an out-of-bounds read when /proc/net/atm/pvc is read.

Tighten the existing QoS validation so invalid traffic_class values are rejected at the point where user supplied QoS is accepted.

Quoted 7 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by Codex:GPT-5.4

I believe the issue flagged by AI-generated review on
https://netdev-ai.bots.linux.dev/sashiko/ is a false positive.

#3 lore raw
In reply to Ren Wei
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 9 Jun 2026 16:34:37 +0800 you wrote:

From: Zhengchuan Liang <[email protected]>

Reject ATM traffic classes above ATM_ANYCLASS in check_tp(). SO_ATMQOS stores the supplied QoS after check_qos() succeeds, so accepting larger values leaves invalid traffic_class values in vcc->qos.

[...]

Here is the summary with links:
- [net,1/1] net: atm: reject out-of-range traffic classes in QoS validation

    https://git.kernel.org/netdev/net/c/cdf19f380e46

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html