Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1607761rwr; Fri, 5 May 2023 17:34:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7bRacYWQwyxOlkC4jvyCigUUvRs9/fdHIAfnV6WtbhBKtdYRiQBrFDrgEOvVb+I5GzBFT6 X-Received: by 2002:a05:6a00:24d5:b0:63b:22e7:6ee6 with SMTP id d21-20020a056a0024d500b0063b22e76ee6mr4842701pfv.31.1683333279055; Fri, 05 May 2023 17:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683333279; cv=none; d=google.com; s=arc-20160816; b=i8DV75oIh1HOTFcSSRT7hyp/KdsbndEatoaXHdEOT7r5elUn+ggqrKkA8JtQ6AmaVh 1xAvTPHPb0DGplrSXoqmldpjvQgtaOJjQ4l5uEdOxgYZ7fYlWg4vpBwWiDbZEf/AKk6e XQnmscciLXBqlk/jafqKpHPky9FxUOCEcOnoWUkJLTZn41y5nU5D3FObFY/B5H8mrgG/ ZR0PUZ/4adGXkcnyoti/K8FjduZvx04ikANQsAU2v6ifkm3xJkF7LWlerq1hWnpY7rek Y/SH2f2mj07m04H3zSfxgi/hGR0DBH/bIJRBWcaOVqZeLFapDyKBG9lkAGv0jaHKyx0h /7gA== 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=LpQnycD4NBJS2K7bUxjOFhm2fk8qfStWlOlna9WRdZw=; b=UtIwls95LshRaWdE48r3tFaBKaHuHU9lQm2zd67xfYdsQyTYHfFK5O5XzVcLxYd1FA WZV1TSU9xwQyPVrbry5e6Cp2jXaWTo/mm6yiqRMMleiFxxcyqMjf3GPNZdQ5qC3stmWi LQK0ysvSWscEw8u84Fon4frIN/lcv8ea8TXNkC71O96wcDfJB3IR4Ceb3MVLWaQR9e49 QF8gC8P/SuMrMZCs13tjaPl6U31VTk/0HusWgaJXlvJrxjMfeaai5u2rFCQ3n5WDAW+B WO1Ca1c1hdxTAGfwE9EKLOSbENojPiWaU8fkJw2zi2CEHdeNsQKeCe/ivX7I7OSDX8t+ 67/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=gHOOwYnG; 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 x16-20020aa79ad0000000b006435b08fee8si3082128pfp.196.2023.05.05.17.33.54; Fri, 05 May 2023 17:34:39 -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=gHOOwYnG; 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 S231428AbjEFAN5 (ORCPT + 99 others); Fri, 5 May 2023 20:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjEFANv (ORCPT ); Fri, 5 May 2023 20:13:51 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E921C65A5; Fri, 5 May 2023 17:13:49 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-55a5e0f5b1aso23125127b3.0; Fri, 05 May 2023 17:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683332029; x=1685924029; 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=LpQnycD4NBJS2K7bUxjOFhm2fk8qfStWlOlna9WRdZw=; b=gHOOwYnGC3x7wKGcS5bH5zVlnyCwlFzmfpKYUNl8Xoi1jNkiau1YcNvRO7t0WDk+S3 j2Nn94jyo9yu7U+2iFOr/rSwTMHfuzKFCWKUbwu6eqjsJyKwzFZsi4JeGbKNzjmGKvbZ 1gIZqOTmU5slKs2lWbOKYN5QUDGnk8CwNo4wsCAknE80c6ZAlpZm/4mRi8naN2yxiW8L PJ2YE4wkqG1DqMbbthU9qBrxSlxzUWy8DYtmZZUJY+4rDw0GvHD9wX0hTcmIH17y/C06 Bg92/rWiT1dnNCAMRsvaaclugYK/WfsHyhJomevuM83/6lvYG9lYpx6o+ruSO850uL0D IiHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683332029; x=1685924029; 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=LpQnycD4NBJS2K7bUxjOFhm2fk8qfStWlOlna9WRdZw=; b=b8ncejNpfNRDct0YuGrUpUTOoZc69gEG/0Sff6Fln9Ak6M0FVQ08mwBVPSS/qLSF+6 Vp1ip5v0gw4ypvPZPQ8dT3fKcMPMA5oTFhC5GITzHusaXdwnnZE4GsGp0jQanuSIewDt LKmtNAAip56QM1xfCbYjhBHeoEYsYEYA1ODoLkCllXYDCdKWK2U4fDDvsQ8H1FwRN/+Y JsxogolTLLm8rAdvxEwdIDWrl1DD6+Vntz3PXi0q+NwZdfWBbb7v4pOI01jj/pCUWYyN QmWSkQTxeWEcRypJV9Mh/tEn7/gDrYSuqAxu2mqmvy18vHZ1Ugj++TU4tAt0G94s0JO2 pmXg== X-Gm-Message-State: AC+VfDwUBZJZF36iPxrc4coP3D9crClCFV2TvGDO5h/6zevxj3q5QS9q nwaP9SarW+252Q2FhqyW0w== X-Received: by 2002:a0d:d916:0:b0:556:b11e:ec34 with SMTP id b22-20020a0dd916000000b00556b11eec34mr3429474ywe.50.1683332029141; Fri, 05 May 2023 17:13:49 -0700 (PDT) Received: from C02FL77VMD6R.attlocal.net ([2600:1700:d860:12b0:5c3e:e69d:d939:4053]) by smtp.gmail.com with ESMTPSA id u185-20020a8160c2000000b00552ccda9bb3sm802377ywb.92.2023.05.05.17.13.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2023 17:13:48 -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 net 2/6] net/sched: sch_clsact: Only create under TC_H_CLSACT Date: Fri, 5 May 2023 17:13:41 -0700 Message-Id: <21f1455040137e531f64fdc4edc3d36840e076ed.1683326865.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 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 --- 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