Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3953166rwd; Tue, 23 May 2023 00:30:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45pY3xFO/4N41AkoN3dja/z/vGFhmzzAISaipQPFo+PrXv5MsPr3VcMXHY2dKJExw5VMOA X-Received: by 2002:a05:6a20:3d0a:b0:10b:f331:d1bf with SMTP id y10-20020a056a203d0a00b0010bf331d1bfmr4917557pzi.27.1684827057937; Tue, 23 May 2023 00:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684827057; cv=none; d=google.com; s=arc-20160816; b=RnOWbbvzGfPGDmgq9ZlEPbIIPw2aV8gBTrh3Y+UJtWGPAkGYvaMBy9G5J6ASpzXpWr 1mp7K0pC4sGBXwr+vfmJnM8Z/MDHx3wdOmGuJx0JhZF1gThcw6nAYYuRU/zhe/wJPfe9 gBeDyLcSGz9b3SHdwNJtgRMpoJL17uYpjm+JzZkCeYzYTMgbZXMXiatKo+z4J//op2aX htRgDuUa+N+IIQh1bE80MgFhxbCVL/xcFvjWbeOB4SvOgzmIKslZNPVToEMP4OkOX5Fs ohlYFa6pF2bMuRvDrAO63++1VRaqMS1zWvrqOn8nIGzW1PzFG5vdi0if0JlKRLZmapi4 TU5g== 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=J74j1cuX46yDfNzc3Qiq/CfJJ1yt4vs8CiBnDAgOYno=; b=0U6y8ZADZEfvevT7jHgtRJUn71yH55tk/mj81HjauYVVjntSNADcHtDsX47TrD+9xQ OTFmERd2RANYNDq3kYgK+7UgME8ih44LxmFPcU949g3YFqw24nLj15uj9uQ8CWpkG9aH wVyQPqn7ImVD1VK9PC6FC2fQUERCMsQpIlUEHHlyyLnTj3YzYJr70ACryFj195A0iHuK ezUS0tIcZtmSPs9nKznT15sCqIEa3DGaIMyGY7Iwzef8U1ESH1ZLC5hgjeqHFT5Knli2 9oAYdX3CR/F7UTSYUTtIuuHKKVd8NxlVVsshGEyJPQ5Pfjnqp1G42HCdy36mPd89n6VP aguQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="E1ue/swp"; 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 u26-20020a63b55a000000b005347fcb785bsi6090339pgo.204.2023.05.23.00.30.43; Tue, 23 May 2023 00:30:57 -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="E1ue/swp"; 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 S235356AbjEWHNf (ORCPT + 99 others); Tue, 23 May 2023 03:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235349AbjEWHNe (ORCPT ); Tue, 23 May 2023 03:13:34 -0400 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DEA911A; Tue, 23 May 2023 00:13:32 -0700 (PDT) Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-75b08ceddd1so223294185a.1; Tue, 23 May 2023 00:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684826011; x=1687418011; 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=J74j1cuX46yDfNzc3Qiq/CfJJ1yt4vs8CiBnDAgOYno=; b=E1ue/swpTD+/IRaBgRL5zqtirLR3tZAZ9mg9A+1dlhC7Jvyd7syhAfXp7E+2jeS20Z tmv0gtu8C6YVRzFZtreeUIG6UUlnetMVKfSfX8iDorSNNhvvX3hipowMBjH2zgr8Iz2K 3oY/qO2H0BOtLFQkNDC828dmLXk0tG05QcLmG92k6PwxupNhsRsphCUezdEisyjhdRu/ dpZ6hzYwOGBezF9/mXiCOp4wKIR7Wfk+s9fyHUlmcVYza0ca1frEBJ+6BpPqKdN430rB WApDLpAqlBowSp97rxxGN0mLOqCNFU0az66snKq4f7ZEeU0GpkjF1/IF1K+PeW/b9Brm IrvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684826011; x=1687418011; 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=J74j1cuX46yDfNzc3Qiq/CfJJ1yt4vs8CiBnDAgOYno=; b=OCkSFLOi823PfZWIev2m2rqz18JSLqrbb8PviQnSK9b9unisXGD6rZF3hneNfbxylo 6B4qjg3Clw1x2t1n3MKS19L9jctBC0hnAYiindv/FkEkT+h2AhSTe2rEtC7UV33QZ8rS emKPXtovzZIy/htqWEMNrzIj5bBACxjZizZBVmVvD3UqV250C6bEfyVrbPzKM2MXSB3J ifbDf605gCnUs0X9J15Hfliii2C0iWhWbe7aH1qq5FlKttLPuGGAgb8ZaM9w4Q/PRal/ pviB02MWY5PINk0f/unMtrSClNGjPT9AvRqmGCm3nR/qA017L+2SFc1bF32aZe13m0Zb xY4A== X-Gm-Message-State: AC+VfDweldg3q94mrFuT8SNKduv4RA0jG8HdtpIg2Pk04Mz22NAS8B6G z6hcdd28q7JjfR8fQ4kZnA== X-Received: by 2002:a05:620a:8592:b0:75b:23a0:debc with SMTP id pf18-20020a05620a859200b0075b23a0debcmr2936365qkn.58.1684826011635; Tue, 23 May 2023 00:13:31 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:d860:12b0:18c1:dc19:5e29:e9a0]) by smtp.gmail.com with ESMTPSA id s27-20020a05620a031b00b00759300a1ef9sm2317369qkm.31.2023.05.23.00.13.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2023 00:13:31 -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 1/6] net/sched: sch_ingress: Only create under TC_H_INGRESS Date: Tue, 23 May 2023 00:13:20 -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 From: Peilin Ye ingress Qdiscs are only supposed to be created under TC_H_INGRESS. Similar to mq_init(), return -EOPNOTSUPP if 'parent' is not TC_H_INGRESS. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: syzbot+b53a9c0d1ea4ad62da8b@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/0000000000006cf87705f79acf1a@google.com/ 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 84838128b9c5..3d71f7a3b4ad 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -80,6 +80,9 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt, struct net_device *dev = qdisc_dev(sch); int err; + if (sch->parent != TC_H_INGRESS) + return -EOPNOTSUPP; + net_inc_ingress_queue(); mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); -- 2.20.1