Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3640497rwd; Mon, 22 May 2023 17:52:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4RKTnLnf9bJwhCJrsJ8NgUyFkqqdMrD9Jpubp8+LOxeqiSx9HlNA8JHRiicX25fP0j8fiJ X-Received: by 2002:a05:6a20:8e07:b0:10b:3d0:ede5 with SMTP id y7-20020a056a208e0700b0010b03d0ede5mr8618809pzj.59.1684803162237; Mon, 22 May 2023 17:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684803162; cv=none; d=google.com; s=arc-20160816; b=u4oDIwBuzoRhIiYJ+psWOQkiUT7itixBgYCVFrPsa/f7jckGn/PMQ2VTW7j+KP9NGm 6WrmIXLGRAOvw9a761PE6LA69cXSNXf3CuFZdh5bAV9iPkFIbFGa859e8ezyNZ2NdaTw BFjtuegK6Hegwi1IXX4edLGJRwvtL8TzfUl76LADF0UtGYDcHWEd4D5X4QEIGAYfHnRJ 8M88F//XKC2GgJwUnJNDKn6XFUfM/0cUEG8mc9DebjD2VshcFC5MIUduDjJZnJgmdT// dDZB/X174QSxbLXfGLowQg/ekWkDUXbQQ5CLeUIVD8K5oE9dMjIuRixppECdHF53l4MZ kA/A== 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=Eg7+MTtOoGginTkEuFUGcJMan5HKcjTNLO6/cJFDlM4=; b=QUczUDX9oO2bhQdPZrAV/qMpYK/+hYqH59dTAtzeCtDdtIjIz0iGlDInyIMKo93isu K29cPedmTqrnZPVtjTCgyZ5Qu/HTgYaf6CqRIU4kKHrsmUZYIO9IqfSpzO2mN/PMJDkv pO8VisOLZADSjVVMbl8cumr07NqsKyTSP9A6yXugizUo8SMpRCoG7QN0pdOe3O63IaRy rOe4QxJJK3gmwfTmLtKKRRs715IH+1zhZx9x4sgPzf5yLLtEOU9+QkVfLVzeQakInNkL 5fTR/o6ReMZvp2BewAd5II60Z+KA//8ekNuBa9irMDCThzHqxm3jaenQxc/bEulFy9fr RPtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hE+VlVPB; 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 g2-20020aa796a2000000b006434bb21d3asi5444218pfk.299.2023.05.22.17.52.27; Mon, 22 May 2023 17:52:42 -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=hE+VlVPB; 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 S234047AbjEWAmI (ORCPT + 99 others); Mon, 22 May 2023 20:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234617AbjEWAAY (ORCPT ); Mon, 22 May 2023 20:00:24 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608252135; Mon, 22 May 2023 16:54:14 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6af7593ed5fso821351a34.0; Mon, 22 May 2023 16:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684799653; x=1687391653; 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=Eg7+MTtOoGginTkEuFUGcJMan5HKcjTNLO6/cJFDlM4=; b=hE+VlVPBniLddnIkLUExM3o1tiW7XrYfN2tezmYlTt87txsC7f9BRTYDdQiyAJhHxm BF17RE/+lSVmvCEg213hhwkePkJvdCWY3waFnayDGJm6vsvmRKSj0CBUvGvsjgkM2wbS Hlj722/CmP6utyeRySZK1l2oajoWjggphwHPgWzFyXFbcM3Q3qoTvB6OUN+gthu5deEk UUgobDZMccRc2G6f7Ln+TdsH/kbq1hgFAS3rlli4tM0IKzo8ZtFIDroz8xItAlaFqoL+ P1Xs+Fg9vieaMtT1mgng2x7eqbaU7/t0NLWQeeq3u7+lXGukqrhDEifjKRMKrqMu82xg Msxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684799653; x=1687391653; 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=Eg7+MTtOoGginTkEuFUGcJMan5HKcjTNLO6/cJFDlM4=; b=kp2r4EefMsUnN2F16V85m0NMrKueuQblNHqcJbcH9QRU80j11fniPwepF+fZf06han hfEsOlPoVa8YxJrTqlMXxksgG3XtQNQZ5Rl9RS9RMKTZxRftCEyKEnd5yYEvfztGg2DY Y9wluuh3Lw+cganHnLcj20WJMmFHaIXYlyxUD037YFbphmrXo5Fms5GGsCa/cmCEaHNA zXzjxPKzmaDYYZW0EwrgaDD/hmKo/IcxIHu/SvKf4+/mt+VgVJvbemx9e+V1r7Mizmtb rAd/12HksXaA/IU+Lg5/GES1HvferpKYmoR7aR9Un6yMEliN524YGGNDj1UIDDwNjkJv 9PGQ== X-Gm-Message-State: AC+VfDxwaBnhxheApI+GdPUN+3AFxVlUx1mWa7WYDBiawAlKW0/swaoM hu7MvtJkQCNFQko1c69uAA== X-Received: by 2002:a9d:6e19:0:b0:6af:7856:5d55 with SMTP id e25-20020a9d6e19000000b006af78565d55mr2673148otr.22.1684799653550; Mon, 22 May 2023 16:54:13 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([208.184.112.130]) by smtp.gmail.com with ESMTPSA id u21-20020a056830119500b006af800065f2sm1318813otq.59.2023.05.22.16.54.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2023 16:54:13 -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 v2 net 2/6] net/sched: sch_clsact: Only create under TC_H_CLSACT Date: Mon, 22 May 2023 16:54:02 -0700 Message-Id: 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 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 --- 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