Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4886359rdb; Fri, 15 Sep 2023 15:53:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElFvycCTN+d+uErTxxFyortt6Ulv7qWOs5UmeJ61rky4dlaCJwTTjaPr6auaDyCsTqpndT X-Received: by 2002:a05:6358:2806:b0:13a:c28f:3cd7 with SMTP id k6-20020a056358280600b0013ac28f3cd7mr3638356rwb.14.1694818420281; Fri, 15 Sep 2023 15:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694818420; cv=none; d=google.com; s=arc-20160816; b=rjO0j2aSGQb/DdEZLnxTcaIPV2Q4yp+trUlrbleust2N4gX+pd9st6nCqep1So8AlB bH81DdZJYzx28/PFgqdg3sSFNk3f87VWostMIqTo4D6gDIx9Yjfyn+rP3lGBPHT9Pxto s33rv6vjaI+rNSQ6H44kMbHSiaWVWGiMMjSuHrngvAYI/RFSwu/PfEwzn2Lr3Jg7rTR3 PK3GbefPSxgPJy0IxWoPpaTuw1y4+paFSUGYyAUhXNXWMInAcXTZEzmmghi6nhW2j3zf tCYZPAC8Kw+ukOF+hD1ojMrlE/oh+Lwh65eAgPF3IyJ+mEqXhSX0qOpRzsNqzaNo4XqQ 2k5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:mime-version:date :dkim-signature:message-id; bh=N9jUf0AezV9CUepWS4dSseHstKPiBlVXkzsuiSmuKZs=; fh=YBaxXdRNB2oIsnj3h4lK9D2IOOz7IBF13qzrtJ96ZP4=; b=zRIJBriBhzCiLmg/+hr6mBLWXUYr9eiSbOVQU2blMvsM3kUtwfPLNZu1AwCRCul49K Y2wSrsXDlJVmXgcJ384u12yWCezhSAGgHWrF4dwJundW8RQuVYI8TywMepghNVD625cj fEPVaQjyZuJY8VbC9Xu1H+HWl0/xX6iON3/na+k9BsyYly1WBW7thTaEZcujeS79qyzW aS8JeUbv3VjA/knvjcjEJXkBaumpByQofQvWtZdqOf7buNk4eX++2FhR/9FlHYVbP29G AfIziuoaQ9FcFofEFP+c7CH2NATfaZlFpx2cU9vjdOeNbYewmqGQJADzhWKYgo6V8JL8 xPrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cWsad2eN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id k130-20020a636f88000000b00565f703e067si3691122pgc.399.2023.09.15.15.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:53:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=cWsad2eN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5A92880E2269; Fri, 15 Sep 2023 13:38:37 -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 S237325AbjIOUiJ (ORCPT + 99 others); Fri, 15 Sep 2023 16:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbjIOUhg (ORCPT ); Fri, 15 Sep 2023 16:37:36 -0400 Received: from out-221.mta0.migadu.com (out-221.mta0.migadu.com [IPv6:2001:41d0:1004:224b::dd]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2655F106 for ; Fri, 15 Sep 2023 13:37:30 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1694810246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N9jUf0AezV9CUepWS4dSseHstKPiBlVXkzsuiSmuKZs=; b=cWsad2eNPDi2UIKGOD+rK2TaN1QvhdjuQcX8rGNgy8SnfvjEzileHeOHufHGj3aDmLH3MZ HTlyOocTWSj8YttEdbm9iyjRYNjHDlkY6KIxhOP3SPGMhhVN4H2QJ2jI4BBIXQ4my0x2I+ l/4eRZcSrWx2fUkUpdRgaB8UEBOexiQ= Date: Fri, 15 Sep 2023 21:37:22 +0100 MIME-Version: 1.0 Subject: Re: [PATCH] net: sched: drr: dont intepret cls results when asked to drop To: Ma Ke , 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 References: <20230915142056.3411330-1-make_ruc2021@163.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20230915142056.3411330-1-make_ruc2021@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 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 13:38:37 -0700 (PDT) On 15/09/2023 15:20, 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_drr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c > index 19901e77cd3b..a535dc3b0e05 100644 > --- a/net/sched/sch_drr.c > +++ b/net/sched/sch_drr.c > @@ -310,6 +310,8 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch, > fl = rcu_dereference_bh(q->filter_list); > result = tcf_classify(skb, NULL, fl, &res, false); > if (result >= 0) { > + if (result == TC_ACT_SHOT) > + return NULL; With CONFIG_NET_CLS_ACT undefined tcf_classify can only return TC_ACT_UNSPEC and the if statement above is always false. Do you have any real issue you are trying to fix? > #ifdef CONFIG_NET_CLS_ACT > switch (result) { > case TC_ACT_QUEUED: > @@ -317,8 +319,6 @@ static struct drr_class *drr_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 = (struct drr_class *)res.class;