Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3942023rwd; Tue, 23 May 2023 00:17:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6SRuFMoKzKIZRm0jv7pByVy5jgy1QMXhEfmZFxUEahjOi5pTZbBMKN6pNEfh/UZHDkIuSv X-Received: by 2002:a17:902:d3cb:b0:1a5:dfd:d167 with SMTP id w11-20020a170902d3cb00b001a50dfdd167mr12383067plb.8.1684826267328; Tue, 23 May 2023 00:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684826267; cv=none; d=google.com; s=arc-20160816; b=dzU/NKwmiC+/0rt5zJNA4AJ9xFSRHuSA6cxSNjj5jeM8AOqrRqaYrl/8qNCdUlttv3 t20SqcsegPBjaXBGtgDo0HOKu5wqsc4thP4cznvRB3tgWsgN85MPS46fAsRnEZhcD+PW WozumaUYWT77vivA3xSO4xLJ/JXywMTWno69A16NLcEjvHyHWs3MYVSktYmagPQUsKvk XE/ekRUMs0iUoS0j2SlHg3mgyacFrvNmn/c24qXvJiQeTUPdTpoZsBMoHedB40/nqsE5 sp4PxBFmxUQmbpfv0fAB0ibjnLyLOMH3JtOPmlCvZHuwP3MpQwdaKHGFklYCOpGTZj2M MCsg== 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=k4RT8KtH61VT5UBgWC5UXkvWjA8gZ1S4WED/F36PazM=; b=OMNVwZn+xe/EAsVf9F9srraf8ONs5WHwvUg3lROa0LaAek7nG1TfdCMV8o3nYu/PZ+ Xla2dHFd1h8iNLFIcg/cPFn+9Nr5jSXl1HHswcTl2QmMOx2N5znBv3/aBjMmDflNND1y ahnFGsf44IyDz3+fdNdrgBrJv+TtR2aMapYiHm2z1/GSsswkBCsal5Lgg1pZdX5sjD8x J8BMsl8FASiOi5eEAuEOFfWRvqHMfDN4H5cXAOftMKFW3PIKhsziFT8Ygl+2lMJXJt6j GflVu8lq+xOOr7QcbFNFuRT8JAKgdgtke07CeJPaj7x2abEaLwtMOzIZvA87UYzKrQH3 /NYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=APMod9rD; 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 x4-20020a170902ec8400b001aaf607910fsi6478991plg.376.2023.05.23.00.17.31; Tue, 23 May 2023 00:17:47 -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=APMod9rD; 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 S235364AbjEWHO4 (ORCPT + 99 others); Tue, 23 May 2023 03:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235401AbjEWHOx (ORCPT ); Tue, 23 May 2023 03:14:53 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A60109; Tue, 23 May 2023 00:14:52 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-3f392680773so34347771cf.0; Tue, 23 May 2023 00:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684826091; x=1687418091; 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=k4RT8KtH61VT5UBgWC5UXkvWjA8gZ1S4WED/F36PazM=; b=APMod9rDv+JDt7Mke9LgtZqH3l4ccae3EMMMsQ8gqTojNI/LELDTXIsWVPQmHDkDtL h2UPoEEQsXZNS8uu2R4OkkqfJ3jLfGsees8LUcwP9BNiRVCjPwzxkukGtekCMjd/nRB6 OYPfZZGdS/Gjh1tHb5f8ZHRhVmOHDAEtMc3raW4QnyPWysPHYwoyitkxx68NXIbk3g6w tz+aGKzd8++nVVaShvpkGFQOCqDJDBfWV1nhQ4sHYKWfzU/oYpbgT9lLCLjdktGvG36+ 6QJJsBVxDuNGbUEwmccZ9yiAlBBCq5k3VpazaB37jyiUiiNJZt/Y/DwmV3Hq8bVpjxWY mNnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684826091; x=1687418091; 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=k4RT8KtH61VT5UBgWC5UXkvWjA8gZ1S4WED/F36PazM=; b=CF9ES4w3+Q0RPwZrNOxO1YGFb1jsQzMYDT67v2KjQzJZXVIqjAZWluVR/QcNY6X6pB Go/Mkor3+fgVQfNe2ioShOViKAoxn9oN0KMncJ6ItVVLV1NPLzluePmWnunNOkzYjoI1 UJwQ4B98PDxt9ms8hwi4xk5LnUU6M/A3QjmVtIqpQu+wu5l+O4xdHDNSVqejycyVSbqu PL/JH0RptZgXvuppxjR8ty1ZrxhbiBzmt9WAi914lCxOm8XXZD/Sakm512WdWQvD/jcQ xSj/YavVKqT34LqMhG+Mc3qY90wvvRRwoa5tAU4aFhsHzcNL+evh0JLiMjGh01emXCS7 Mvow== X-Gm-Message-State: AC+VfDx4F7m7xUDnGLMbpidFF9YBNfgL9uxZRWZMjopS3bhEHAcngAeI TJF+C1vBKywMX9orz42GfQ== X-Received: by 2002:ac8:7d0c:0:b0:3f5:3982:fa26 with SMTP id g12-20020ac87d0c000000b003f53982fa26mr24549341qtb.14.1684826091444; Tue, 23 May 2023 00:14:51 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:d860:12b0:18c1:dc19:5e29:e9a0]) by smtp.gmail.com with ESMTPSA id b13-20020ac8754d000000b003f364778b2bsm1867381qtr.4.2023.05.23.00.14.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2023 00:14:51 -0700 (PDT) From: Peilin Ye X-Google-Original-From: Peilin Ye To: "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 , Pedro Tammela , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Peilin Ye Subject: [PATCH v4 net 2/6] net/sched: sch_clsact: Only create under TC_H_CLSACT Date: Tue, 23 May 2023 00:14:41 -0700 Message-Id: <042ff4af742ef0ed76fd5bb55b914403954b9d9f.1684825171.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") Reviewed-by: Jamal Hadi Salim Acked-by: Jamal Hadi Salim Signed-off-by: Peilin Ye --- change since v2: - add in-body From: tag net/sched/sch_ingress.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 3d71f7a3b4ad..13218a1fe4a5 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -222,6 +222,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(); -- 2.20.1