Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4806126rdb; Fri, 15 Sep 2023 12:52:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFezqfe1YI2txxmIw1G2tyBfe00eU5/CQ1ZhUap3EiZeJpo4zogIBNgwgj/Y54VtCU1mijh X-Received: by 2002:a17:90b:4388:b0:269:32d2:5ac4 with SMTP id in8-20020a17090b438800b0026932d25ac4mr2627275pjb.25.1694807529398; Fri, 15 Sep 2023 12:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694807529; cv=none; d=google.com; s=arc-20160816; b=ZNM/xRA/Nt2mlhIWnKZoJPIEde1rakNlCtD3JGvbmYxkTKy1gscxVixFmwnM4K/Lcw KpYssi6uXLtz7G0jtUWbGnU+mqpS7MSswvaS53AM2ZBqrNdEyMWF/sS58/c8M3opwJ3y ytvYzlYxsD5hqi0XyCOkKIDRaZVQsdUaWXnzEJZFnAAHuVXSarIV6EbyIuG53RlGeoB1 JofhmWTJVbeqsw+LBFysvWdHSOnWgWfgVUT/47NG/youmAPbADuVV4BhfVfHkNpBweN/ ncrPPB9QzbxA3MJsscpUng9cd26rC3WTc6B97GqnLIrE6oEE6A7RQFlegUn8AB0PD5Oi 7Yvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ian4KdZXmKFMo5ATT66+8ryOQHatJUEavAax22/9xtM=; fh=Lhc+B1IAKUn1RsxuJHH46lwvOqIzUUbVW8X4qBDgKzA=; b=whMf6aH2OP1MxJAuzqi7VygmE+skH/lU1g5cq2IKQpoDhlzywGtEpLoqE2lK7zXqwM R8PwGH9rwywpVzIEq9trdALKRZd5Z9/xq7qhNnSH8Q+X87TKDpR1ECcGQpo0bVCBiNPK V8hcwXWhcbwTVYxtkFGwGVH6qGWxLphESkLKbwbp38C/nx/KU5YowLb+VWY/aExqn0wz Zz0cormuyZ8r20RVlk4tRH+fn4WFu5FHeiOayPyWHj5hUGJk4pd1vavO/NRNNwdWY27U 7PpCxgNoIajufDo3n+4uVcO32c/jjNx+mG9rL56d3F1miVqXMLfsZdYni31PyCWJQFAn blew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=L3qVWDW1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ha11-20020a17090af3cb00b002747da1ef66si2853964pjb.53.2023.09.15.12.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 12:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=L3qVWDW1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id EEA3280ECF89; Fri, 15 Sep 2023 07:40:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235789AbjIOOkg (ORCPT + 99 others); Fri, 15 Sep 2023 10:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235795AbjIOOkf (ORCPT ); Fri, 15 Sep 2023 10:40:35 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D412A1713 for ; Fri, 15 Sep 2023 07:40:29 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-41513d2cca7so345751cf.0 for ; Fri, 15 Sep 2023 07:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694788829; x=1695393629; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ian4KdZXmKFMo5ATT66+8ryOQHatJUEavAax22/9xtM=; b=L3qVWDW1dbmk8GpWmRPl0hqNX2AGqrzf4fsv7AvEWCnSyfdgcrgiCZz/fUEERA40ay Hqu0RFaz1cNIyejGluY2McxJXGiHtnw7tFMDsA6GthLJudivDlvopP6aY+6G156T2T6U v+F6HaKLtO6KOxbXl/XLmi81WQb3gBm07u5iUyeu33pU6RByqShfAEd90POP/p/lv47A kDLZ+1BHyVkoL0zk4oLXXo1DrKw8lPxoMqaAwH0+l7c7o/Q+JAIFaOPXRvwET3MbNuZX TFtw0iXWAJf2rHPyfJ4mtGP8rOns5PgLcTbtrqCwrvrRCeHtn2uWNtsZoGUqV/qmEB+2 s+5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694788829; x=1695393629; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ian4KdZXmKFMo5ATT66+8ryOQHatJUEavAax22/9xtM=; b=rJzyfcj06QsIAwFhtAnjMZ1JVkiqXDBgYmCxyfNrvfxrMqZDSIGBkT1vR2IV1mD7fk 85jvaHMvYKHznMtYOUKIRrcH47hdtwEcV/xeL/VpFBcIsyJeZ55uOMDrL9P/FRU/4BZF zLrtkGhZPm0XYzQdsNXKj6wK4946vWeTIWWhkmwUXNt4Ql8uNZHRsClHXIifP3xsThYD sVMPlCm9QAxjK7ba9ry0io0gFJdosT8lcRY9dCwI57M4d/Rq5GVauAAn08JYVYiSKthJ 3SjT9II69TT9Y6HFDiVWJtV8OZMZlggJACGK3FBHA1R9ai8V7nbTPTfvBosj12sOg2Ig t9PA== X-Gm-Message-State: AOJu0YwdTx3Cc/kdCRQRWIiy1Yk95wMat33KA75w/2FbimHrm7voNWRG VTzxHr3ncNCZ1lcOHgeBKKhJBIz5Khahfr2wequVoQ== X-Received: by 2002:ac8:598e:0:b0:40f:d1f4:aa58 with SMTP id e14-20020ac8598e000000b0040fd1f4aa58mr247843qte.8.1694788828644; Fri, 15 Sep 2023 07:40:28 -0700 (PDT) MIME-Version: 1.0 References: <20230915142719.3411733-1-make_ruc2021@163.com> In-Reply-To: <20230915142719.3411733-1-make_ruc2021@163.com> From: Eric Dumazet Date: Fri, 15 Sep 2023 16:40:17 +0200 Message-ID: Subject: Re: [PATCH] net: sched: htb: dont intepret cls results when asked to drop To: Ma Ke Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:40:39 -0700 (PDT) On Fri, Sep 15, 2023 at 4:27=E2=80=AFPM Ma Ke wrote: > > 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 =3D NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; > while (tcf && (result =3D tcf_classify(skb, NULL, tcf, &res, fals= e)) >=3D 0) { > + if (result =3D=3D 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 =3D NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; > fallthrough; > - case TC_ACT_SHOT: > - return NULL; > } > #endif > cl =3D (void *)res.class; Can you please stop sending patches that are not needed, as already pointed out ?