[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230915134408.3410595-1-make_ruc2021@163.com>
Date: Fri, 15 Sep 2023 21:44:08 +0800
From: Ma Ke <make_ruc2021@....com>
To: jhs@...atatu.com,
	xiyou.wangcong@...il.com,
	jiri@...nulli.us,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com
Cc: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Ma Ke <make_ruc2021@....com>
Subject: [PATCH] net: sched: hfsc: dont intepret cls results when asked to drop
If asked to drop a packet via TC_ACT_SHOT it is unsafe to
assume that res.class contains a valid pointer.
Signed-off-by: Ma Ke <make_ruc2021@....com>
---
 net/sched/sch_hfsc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 3554085bc2be..8e07a215f7d1 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1135,6 +1135,8 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 	head = &q->root;
 	tcf = rcu_dereference_bh(q->root.filter_list);
 	while (tcf && (result = tcf_classify(skb, NULL, tcf, &res, false)) >= 0) {
+		if (result == TC_ACT_SHOT)
+			return NULL;
 #ifdef CONFIG_NET_CLS_ACT
 		switch (result) {
 		case TC_ACT_QUEUED:
@@ -1142,8 +1144,6 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 		case TC_ACT_TRAP:
 			*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
 			fallthrough;
-		case TC_ACT_SHOT:
-			return NULL;
 		}
 #endif
 		cl = (struct hfsc_class *)res.class;
-- 
2.37.2
Powered by blists - more mailing lists