Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3581156rwd; Mon, 29 May 2023 13:05:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6b/uZWOeGfR45KWo3Jzz5iVSUIsmFQ1C5s+2ksV7n629tVKHwR+wwVKyjrsfB2pW3Joq+D X-Received: by 2002:a05:6a20:be98:b0:10b:8ce2:6a94 with SMTP id gf24-20020a056a20be9800b0010b8ce26a94mr65808pzb.14.1685390706155; Mon, 29 May 2023 13:05:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685390706; cv=none; d=google.com; s=arc-20160816; b=omlCg3eETkYd3rj3d0INb5clxa5zq5dTAogm5+L7AQpaNrhHU0RVMog4QSnrDN6SOQ /Sd0yn6GQYnCkul96K67h4O3DJ5tuF5jUTfKBcLI8B7eM5RCseRUCdZ88fB77VVIlu8l KU1/lPu2Y2Y8lwHXaO7icR3VL5pnFWu5ZTra604RO5X0Cchc3gVFO25NykcMhLv1cEC3 1ah+D21e8a11gzwG4oVLLXQqtLlyYicaiLf4YfRcL89bXEyICEhn9EcpzEB+zb/So2zs BRubzf++J7PFCmy0dnTpbF86G0I3hc9RKvYFMQrEdPo0c1smp+nGT9dYodhBPBsDZiGJ PpOg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UcEdDdXCSlEJHLE21T8eIPNeaLZDuAJRCHh3+SO0w/s=; b=1GWwPgLjRU8PSO2KkeehU+3d+Z/2Bv9ZN44EtZc+16MVSpk02bDnraqzY7fJuWVerE ozgAgvN6P3fyU4nccQCYqYzG39IWvhw3ZOJmU6MExFRHYFfkHwXlM/vHP2WYjRregFmP +JKcF9lUqYoQmI2URBdsjc2hIBbAlCBTun1CrNnULlo1MGxOG8yK9wEuifpR2vhLpe1i Hlw/2FX67JUN7GYQMbuiw5HtEvjBmAxoH6q91Lm42jvVj23sD9cGJJ8pE4cHdtkn469Y Cfsgp7uvv2/Ql7wbV3sNyNM2bB0csy4m8scMmBQjqQbKJqj5K7yhlup00UQ1cvTFDVIF xjCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="rX/CyrnU"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 83-20020a630056000000b0053f16344dbfsi10106475pga.812.2023.05.29.13.04.51; Mon, 29 May 2023 13:05:06 -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=@gmail.com header.s=20221208 header.b="rX/CyrnU"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbjE2Txt (ORCPT + 99 others); Mon, 29 May 2023 15:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbjE2Txs (ORCPT ); Mon, 29 May 2023 15:53:48 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE6EDC; Mon, 29 May 2023 12:53:40 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6261367d2f1so9251346d6.3; Mon, 29 May 2023 12:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685390019; x=1687982019; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UcEdDdXCSlEJHLE21T8eIPNeaLZDuAJRCHh3+SO0w/s=; b=rX/CyrnU5xB9CWMptTZ1HHdd3qB2l0CWh6sO7e+pCFJvhr6i0dbnjK3wrAu0AW2JHF hnqzGFk+VVKdzFemrFTX3CA7UPM5XOi9+P0nlhD8IylSPLXo5ldEZ8XeocCn2rQZphuc 0T85dS6nab93Z0wD9qNrcuPacVmCgNk0SJKim2ZgqVi+DtMblcy7FB1kGlKbx3HRk/9T XLcvOu7wgX9PTDLDjf0ozVnuFJTlqpqeZKXEzret6aiZnHwLIjZvFgQZ0slvwU70qVAA 11V6NwmcC5GE2DI5XMcvPkPKOfncI6Jh0PFkFF6lSXJZnHO/ClOZqV/NRO144ImMJfGK do0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685390019; x=1687982019; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UcEdDdXCSlEJHLE21T8eIPNeaLZDuAJRCHh3+SO0w/s=; b=h6hPZYBrm3RWGHZPP/+4YM69FVa4gkSGl4ggnsdfE3xSnre3WLNRL/AzziU75IvxBb 9xdiVSqJ6jOXAlFS9YgBH1ChLBeY+v+uHXGZeXHFHba4YKtrC7k+D4bM5vJnxSwyDQmZ NmkvamFlYz+SpZ+u3ksqmoDzCfAzMZyxlG6au5uCw70EyPyl0aWYPZAjiGwBRaxvbehJ xdomBbZ4AMnFqz8P/5HbrQKFAkdXNLGgVbk0Yq3B8VejRg19fpX/Q+WnsXMbPFtdkv8s hmV+oce2+4BhxnIXlhR13Kp6LgD6fZYxjsVGYpIEtX5cKlVegRTlz5h2VhrwGL/U6g1b DSIg== X-Gm-Message-State: AC+VfDwSw0ueT0SSQhuCRPm7jQ2cXyIHhJ9QzDi4fFIH1Iz5Mvw3zU/G 5TgHO/uoMX2mN3K8zZ/OR735rqTljA== X-Received: by 2002:ad4:5cc1:0:b0:625:aa48:fb6f with SMTP id iu1-20020ad45cc1000000b00625aa48fb6fmr15746577qvb.57.1685390019537; Mon, 29 May 2023 12:53:39 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:d860:12b0:e554:e6:7140:9e6b]) by smtp.gmail.com with ESMTPSA id c11-20020ac853cb000000b003f72236e150sm4103258qtq.33.2023.05.29.12.53.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 May 2023 12:53:39 -0700 (PDT) From: Peilin Ye X-Google-Original-From: Peilin Ye To: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Peilin Ye , John Fastabend , Daniel Borkmann , Vlad Buslov , Pedro Tammela , Hillf Danton , Zhengchao Shao , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Peilin Ye Subject: [PATCH v6 net 2/4] net/sched: sch_clsact: Only create under TC_H_CLSACT Date: Mon, 29 May 2023 12:53:21 -0700 Message-Id: <2b012b76ec2315729d3e993a69b36753e8d9d29f.1685388545.git.peilin.ye@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 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") Tested-by: Pedro Tammela Acked-by: Jamal Hadi Salim Reviewed-by: Jamal Hadi Salim Reviewed-by: Vlad Buslov Signed-off-by: Peilin Ye --- 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); -- 2.20.1