Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5953419rwd; Wed, 24 May 2023 08:55:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/McurVCQvY+4wyOiTNh9fBO3BAbNPxeuRPV30GmP1lmPDC+1GyK6ql0ZHLwaNYdqsS4PO X-Received: by 2002:a05:6a21:339d:b0:10b:4a5d:87e with SMTP id yy29-20020a056a21339d00b0010b4a5d087emr13065850pzb.53.1684943710890; Wed, 24 May 2023 08:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684943710; cv=none; d=google.com; s=arc-20160816; b=DGLn6YYitM8m5gbJqZKRSXdzoCCMRVYZudjmLIR25vbMG5dzRbRvkeDF+/iJDO7paJ m9SWc+vA07Zfrk4BOTU32/D4I7QE48tJKUt/NBrPma+kH14JTotNsCN4BbamZxjsQElD rDJEjmkOkJudwFKi2BtLRD86M6Wtcf0aoXnJPT9OH8WcMCCII2dyozSu35DWCUeDgCex pdGlkdPkBRplNrrUUN0xuBDOiF/re5hiYUKzOz7ZqT2Q+hjsWXQzJGE7SjM5b670BDfR ti32Vqr989UO8QIFWlC5iCqJklWAy0qBn9Y709bxyIs+3CY8k4Q02R0d6UroSYSIJ/k7 BHfA== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Vr8uCO2pIAbrA9U96g+r92G07hF9QBrSlMFZYQ43XME=; b=lqJXZdWWjbV6Zs3pdodvzvDsTKVchFBXhiZ3PsrLxW7Sp0uDt7CJ12NDzc4q9n/GB7 6xAxtqKVk1Ryw3xuDQYKiedvnTKqGj52j+GMm0Tlq6EOsoWF4UH7H1KoNT8ltOGK8pVE EmFAFHIvQuW+SJkEgnyRYw0njIHM0nlaEOX4lfXKWUBTIuiwX/jBGg5HmJS7GnqhHjNg HKqL5awPNw7roXjEzvVBlTXDzWzVs7wgkaYz/TBihVozmX4wASkRaJpk9h1ZkBeUwi93 yPOtdONKsMF8mKz0mJWVOYX5qXo4mUUkFVnL7qvF2ZK4WMbSLjuyUf2FBelEsASLXwNH LEUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=EoSFSw98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a17090a109600b002475bc0a186si1531539pja.69.2023.05.24.08.54.58; Wed, 24 May 2023 08:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mojatatu-com.20221208.gappssmtp.com header.s=20221208 header.b=EoSFSw98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236883AbjEXPka (ORCPT + 99 others); Wed, 24 May 2023 11:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238034AbjEXPkL (ORCPT ); Wed, 24 May 2023 11:40:11 -0400 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE4A1701 for ; Wed, 24 May 2023 08:39:23 -0700 (PDT) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1967cd396a1so295725fac.0 for ; Wed, 24 May 2023 08:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1684942693; x=1687534693; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Vr8uCO2pIAbrA9U96g+r92G07hF9QBrSlMFZYQ43XME=; b=EoSFSw98b231ljQgiJ350x5qoL4tRR/YjcUt1vm/e6JJOgrc8OAR9KPrRJhsG0z7rV D+8Ah+Yv+ZiXsqdYEECXbtkOqp76fxMokSrGJndjuEzOvHwrNyRtX/js3AdC45D7Axit CncXKIz9ayB3x5kN7iWzN+wDhlyn2jlefIoDh41qwjc4Ss1pAW4lpTcMzf+bxXNKwJpV lgdg9RfHJEaZvFwjH02Lbjr9adVpftXXjFTLR1WklJNxLXtBd31rzQG+69zB2f5ttF/d UQ9kh4foQhkPvjTK4RsyhLP7AN4J48hi2U61Gem2C7NM4uckXLQ0QDmoNdFDbrXYTo3f ERAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684942693; x=1687534693; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Vr8uCO2pIAbrA9U96g+r92G07hF9QBrSlMFZYQ43XME=; b=RiTDwj5vubjMfKZ+BYd5vQX3xVydW/mfxx9Ml71TRKGLaX0qCkDCeN3KqZ7gbCMbKk KpSppOvkvfr2wlVgtZ9YHOH7Ncsz7ZbTJM9Oh9y0tr5uCDFCqjxOxYh8ZvfeTVWlGMvK XwpOXb9sLSItXKP33Y5sEUgieBZBvE7RQX83YB6Uf3d5WX3z/QvmwiuOLYuLg1YKjdha xwQMC8E1kUKRJbXzVI4k6s1bk8cPRD4YvO8SfmYkKN5gLUno/b+o1HxbHqM/BRXeq4+x W4JFNd7KNifjEBaGXSMP0+tSrKCbiyiI4w7fl1eAeVR/g5ykOtf2bsX/RFesUFXB5Oju o8/A== X-Gm-Message-State: AC+VfDzK9Wbluy1Ff9UU7ebfrn19Rbf5rgOEOXaKIrspc9FdRtnWAoTj 8zwOnAtEJShRe4Ufrr5MlEpsPg== X-Received: by 2002:a05:6870:7343:b0:192:597c:1c17 with SMTP id r3-20020a056870734300b00192597c1c17mr162453oal.7.1684942693571; Wed, 24 May 2023 08:38:13 -0700 (PDT) Received: from ?IPV6:2804:14d:5c5e:44fb:522c:f73f:493b:2b5? ([2804:14d:5c5e:44fb:522c:f73f:493b:2b5]) by smtp.gmail.com with ESMTPSA id r18-20020a05683001d200b006af7580c84csm3599958ota.60.2023.05.24.08.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 May 2023 08:38:13 -0700 (PDT) Message-ID: <5fda8703-9220-4abd-7859-0af973d0d1d7@mojatatu.com> Date: Wed, 24 May 2023 12:38:07 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v5 net 2/6] net/sched: sch_clsact: Only create under TC_H_CLSACT Content-Language: en-US To: Peilin Ye , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: Peilin Ye , Daniel Borkmann , John Fastabend , Vlad Buslov , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang References: <0c07bd5b72c67a2edf126cd2c6a9daadddb3ca95.1684887977.git.peilin.ye@bytedance.com> From: Pedro Tammela In-Reply-To: <0c07bd5b72c67a2edf126cd2c6a9daadddb3ca95.1684887977.git.peilin.ye@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On 23/05/2023 22:18, Peilin Ye wrote: > From: Peilin Ye > > clsact Qdiscs are only supposed to be created under TC_H_CLSACT (which > equals TC_H_INGRESS). Return -EOPNOTSUPP if 'parent' is not > TC_H_CLSACT. > > Fixes: 1f211a1b929c ("net, sched: add clsact qdisc") > Signed-off-by: Peilin Ye Tested-by: Pedro Tammela > --- > change in v5: > - avoid underflowing @egress_needed_key in ->destroy(), reported by > Pedro > > change in v3, v4: > - add in-body From: tag > > net/sched/sch_ingress.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c > index f9ef6deb2770..35963929e117 100644 > --- a/net/sched/sch_ingress.c > +++ b/net/sched/sch_ingress.c > @@ -225,6 +225,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt, > struct net_device *dev = qdisc_dev(sch); > int err; > > + if (sch->parent != TC_H_CLSACT) > + return -EOPNOTSUPP; > + > net_inc_ingress_queue(); > net_inc_egress_queue(); > > @@ -254,6 +257,9 @@ static void clsact_destroy(struct Qdisc *sch) > { > struct clsact_sched_data *q = qdisc_priv(sch); > > + if (sch->parent != TC_H_CLSACT) > + return; > + > tcf_block_put_ext(q->egress_block, sch, &q->egress_block_info); > tcf_block_put_ext(q->ingress_block, sch, &q->ingress_block_info); >