Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4734661rdb; Fri, 15 Sep 2023 10:35:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEm/FwTjcZhFLrCvhDOclKub+IMpNwMZE8HEHGUHyZwe1cxPSjd8m2pyEgujTuK3ouaTWe1 X-Received: by 2002:a17:902:6806:b0:1bd:f69e:6630 with SMTP id h6-20020a170902680600b001bdf69e6630mr2112773plk.65.1694799313291; Fri, 15 Sep 2023 10:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694799313; cv=none; d=google.com; s=arc-20160816; b=f77yHm0gLT8vOeeREaS8df49faGk3WcU8WcUhSxX7GNPJdUj39c9gMOViGhOtZMaoa NblO/mB7BcJEis7koAHbNgrkJWkIFQXcqmm3pyN9mPYGK/x1Bmz1BANIFxG6AFbtAop2 wWw7pPWY+5Aw9yUx6Mc8q+W4GpDawkjipIe8gojT+a6/0xlTtLlZIVj93hzYxAk6qhNh ni8JY0/i3goKFRXWdM8JwXhzdELYrO+6lndl7imVnebxS0WJwXINcTwPb5S3OdWBH/Ah i6614MJAwZLPOHF+kBXu3DFBwx0xok3Xfp7C067k0379op2/SlM/hf+ZQHy+vNUKXWyU plEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4LvqkwMnGvJjRQ4h90L6sdZDECeah6lwsJd/8WR5NmQ=; fh=h+oqCAaiwtFH7G2zIi+LrJhsty/KV7zshKJ6igaqJlg=; b=nPVkzKTZEJ40xHfqk1iOLKSmC11wqmwCuD4LWGkLP73cgyFwu9XEaHgff16IsSXZKc in/F4lGoLAoZBmoiMrtDcCCFZ18m/Z1OBvLi50ZRK6iBFmi7NJghAIbQZuWg+41IRQku 3xMrBWq24U3kfFos9hXYkeB6s1OkMVhAyAk6a1zKNpi227Br9N2fJ4ItLQd5IEvaVH2A XskYTFOTNJbF2rauQ45lmNCCINn4hMKTRtegp+qD85m0hHr/0ZuhZ3ZOQUIsG04xa2R0 xNCTgC3o8wbb25289UwG+YIMJed5Zz1bJwcyQbncFRN2q9KhiV9HTcl+SmCT9Qg8KYOi 21dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="Ad/cZ/aU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ij14-20020a170902ab4e00b001bbca0a8393si3659094plb.56.2023.09.15.10.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:35:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="Ad/cZ/aU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 268F28347A51; Fri, 15 Sep 2023 07:29:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235737AbjIOO2v (ORCPT + 99 others); Fri, 15 Sep 2023 10:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234569AbjIOO2p (ORCPT ); Fri, 15 Sep 2023 10:28:45 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2BAD1FC9; Fri, 15 Sep 2023 07:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=4Lvqk wMnGvJjRQ4h90L6sdZDECeah6lwsJd/8WR5NmQ=; b=Ad/cZ/aU278bMw80MDtD2 LcHVM5GRUruIkBVpttf048dqEs9ZPBCdmMQUTo5cFe4QuaCsVa7+UbJ6ZePBUq+h 0OEma/RFo/7uOlUiPM9jPZ+ZEoE83zHIXhy6pqfptQgOd8dp8OSrp81Xtcmw8KeE xfFKOWJ8APYxHV5mWI3/qk= Received: from icess-ProLiant-DL380-Gen10.. (unknown [183.174.60.14]) by zwqz-smtp-mta-g5-4 (Coremail) with SMTP id _____wAXtirJaQRlm7SGCA--.42638S4; Fri, 15 Sep 2023 22:27:31 +0800 (CST) From: Ma Ke To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ma Ke Subject: [PATCH] net: sched: htb: dont intepret cls results when asked to drop Date: Fri, 15 Sep 2023 22:27:19 +0800 Message-Id: <20230915142719.3411733-1-make_ruc2021@163.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wAXtirJaQRlm7SGCA--.42638S4 X-Coremail-Antispam: 1Uf129KBjvdXoWruFW7ury8JrW7Xw48ZF1DJrb_yoWDWrc_Za 4kGrs3CFyxCrn5Cw1xuFs2kryFkF1fZ3ZxJwsxKrZrXw1rCrZ8Cr18Gws3J397WFWIka4U ZrZFg3Z3GrnrCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRt6pPUUUUUU== X-Originating-IP: [183.174.60.14] X-CM-SenderInfo: 5pdnvshuxfjiisr6il2tof0z/1tbiPRXrC2I0YecgCwAAsz X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:29:00 -0700 (PDT) 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 --- net/sched/sch_htb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0d947414e616..7b2e5037b713 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -243,6 +243,8 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 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: @@ -250,8 +252,6 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, case TC_ACT_TRAP: *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; fallthrough; - case TC_ACT_SHOT: - return NULL; } #endif cl = (void *)res.class; -- 2.37.2