]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: sched: atm: dont intepret cls results when asked to drop
authorJamal Hadi Salim <jhs@mojatatu.com>
Sun, 1 Jan 2023 21:57:43 +0000 (16:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:58 +0000 (11:41 +0100)
[ Upstream commit a2965c7be0522eaa18808684b7b82b248515511b ]

If asked to drop a packet via TC_ACT_SHOT it is unsafe to assume
res.class contains a valid pointer
Fixes: 45255a370237 ("[NET_SCHED]: sch_atm: Lindent")
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_atm.c

index 6385995dc7005fc0d5a9b4a67f586fd6f7f39429..34dd0434d99d5662d735ef84997d4efe2dacacaf 100644 (file)
@@ -396,10 +396,13 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                                result = tcf_classify(skb, fl, &res, true);
                                if (result < 0)
                                        continue;
+                               if (result == TC_ACT_SHOT)
+                                       goto done;
+
                                flow = (struct atm_flow_data *)res.class;
                                if (!flow)
                                        flow = lookup_flow(sch, res.classid);
-                               goto done;
+                               goto drop;
                        }
                }
                flow = NULL;