From patchwork Tue May 23 06:19:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 97736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1929238vqo; Mon, 22 May 2023 23:21:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7AfZDXROULJ62P9YiK6l1TO8uziSddpkdfGiinyMjexss04jZJhpiFbeaWfqXwwNFsi5rK X-Received: by 2002:a05:6a20:9f4a:b0:100:6f8f:7793 with SMTP id ml10-20020a056a209f4a00b001006f8f7793mr11353375pzb.3.1684822867253; Mon, 22 May 2023 23:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684822867; cv=none; d=google.com; s=arc-20160816; b=d+FH6oBbcoOnBkgigz56DkZ2G6LQo3UJD/r7pOv9iG7rFlV1zjy8JOENd67iEiALfk 1WDr6uG6JpDoEW1m0BHeaBUefleevVsDnmHKlclWaGZ7UNZqme0knuE+I5uM7Wz39eeD SJS31BlK1RgFc0yWJDXDKjUoWMczp/Iv5YTDYAchIL0GuNNNrygWZ0EHnAdgKtVzEM5D ausvJGcX7mqJQjUUW+uJUFfrqXvABvD+/F2Q+W3cToxBoF3w++o/WcUO94Zv5pdTMFqd xn35pxbIqa2seFdZotLaVhIVujeuEVEQ2QEMc/h4X1d7J5qiC3rqeaJavWEw3gj6Phdh AWSQ== 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=9o/AkYCvO3tV2BU0V8GNdESZ1hmHFfJ/JAYYnq2G7Ts=; b=XufNOSDElFpd7TMx2se9tJv/UnzjdoFzEtwzEmBT+KTQ+ZiswpLxHLhFtShFy1ZLwr qr2mXsiTqsSA0wYUPLwFi4GzxnE9Yoevv82VqB+TS7Hj808FN9Oy6Jj9ei/TTO+050V7 FBhGE3tM/16C7qR3xqgtD1Cdm+P79JRAbHNb5vDPBnkCUdG0QjoPsRrfXnZ+bx8QZmmE Zpp4KVqrK29fp5DCdVigzmwqU2yWrLJ0KLWa6zvIF6dH1oVgkc/OiT6Kt7oKfj0//EM7 MQzTKQEEuoyrrqECLmlt/YG07ZZ0MqZnBzl2U2mjbW6A1G2RuAOFgTCp8zyjfzsQkCrb fl0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ltSNDHag; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i73-20020a636d4c000000b0052c30f80affsi4639682pgc.94.2023.05.22.23.20.53; Mon, 22 May 2023 23:21:07 -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=ltSNDHag; 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 S235197AbjEWGUI (ORCPT + 99 others); Tue, 23 May 2023 02:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235193AbjEWGTz (ORCPT ); Tue, 23 May 2023 02:19:55 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D152F119; Mon, 22 May 2023 23:19:54 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6238386eb9cso59272966d6.1; Mon, 22 May 2023 23:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684822794; x=1687414794; 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=9o/AkYCvO3tV2BU0V8GNdESZ1hmHFfJ/JAYYnq2G7Ts=; b=ltSNDHag4sBJXgnPrLe1CebvaUqaao+DR+zTyCo5AHases8sTOQVIaeH85q1QXnnAY lQw9vk7fkxQB7hrKCsNxtdOX+J9HbTj13D7yi4YjM3s+ZmhpaOSygpboeXXoyboMMK9v DU0++lebgnMKXewdizqARwdvl5VQSujfrfDX1D/6Ka1h/IPNHjbP045rveIPdQ0xat// Qb9F0P3aECjUjlNGFDZ9o5MqW62U6ezv9UB4cl20RNuVouXEA7ZcyP6Fc+5fyWWHmJFb 742h42pMC68PBgRJWiB7RLMXIcTPuENNXj4lXCCdUa0rZCXki+JwsBhCq6LewsvB8uBB 27Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684822794; x=1687414794; 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=9o/AkYCvO3tV2BU0V8GNdESZ1hmHFfJ/JAYYnq2G7Ts=; b=HmFgx9fVRVIwmZ/BH3feVS6xSwLhp/NJkvToI/URFNlqB1gqQmmnJqRh+SX0+obN+L yyFDTScUbeed5t8S7vdaoD4oDHZ42e5ABWmDfT4o41y/KjrAVRk/MQL13a/JPn4ba+ra Da0AUksm5Iss8ppPjvRV+l+PeE+cgwIH+ADLJLIFE4joKMPLJ7YrrWso+Rwoayl/vQ5/ /RFnNVGY7pMY8MKEDI9/OYFFSV+Ozx5h9ZrYCZUjSpe8FtAe749m8+0Mhn3zPQefYxhM ImBSSm3GnGmN5qyAZre/idpPeE5wnZyhyZdXU89PpPfx/V9WbRKbtSRBqVjyh+S9pRnK 6sUA== X-Gm-Message-State: AC+VfDwS2ml/hQ3Br7e72BoFFhgAZ4rJrPMkN1Uq8y2x2vhe9V9bRyR5 NHxGpgbPGUdtafzI9cmiyw== X-Received: by 2002:a05:6214:29e9:b0:625:8b9a:b426 with SMTP id jv9-20020a05621429e900b006258b9ab426mr3639169qvb.46.1684822793931; Mon, 22 May 2023 23:19:53 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:d860:12b0:18c1:dc19:5e29:e9a0]) by smtp.gmail.com with ESMTPSA id ev18-20020a0562140a9200b0062363e7dac5sm2502043qvb.104.2023.05.22.23.19.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2023 23:19:53 -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 v3 net 1/6] net/sched: sch_ingress: Only create under TC_H_INGRESS Date: Mon, 22 May 2023 23:19:44 -0700 Message-Id: <72c5a2b8ae1c3301175419a18da18f186818fa7c.1684821877.git.peilin.ye@bytedance.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766664822856696010?= X-GMAIL-MSGID: =?utf-8?q?1766664822856696010?= From: Peilin Ye 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 in v3: - 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);