From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6CB419BAB for ; Wed, 7 Jun 2023 20:33:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3980AC433A4; Wed, 7 Jun 2023 20:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686170027; bh=MtLFGGdfVD8voEQjUVBWPh5UYCcmvwrNGZHzw9DVQnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2RZcgVpyA4neygvsbDR8jNtMotzNV5CdRjcF++IAn0WD4htOH9pXg2aaZS4aD7pz nWHW+plj0DGTPKn9HSyJhclxUrqBIFPCQypWoL9Vv3pkEmJNzet+zkXr0bblBxH7uq QV7qcUgyWtE2uarE/XtqLMsGfSop1fAZnN4FWZdk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+b53a9c0d1ea4ad62da8b@syzkaller.appspotmail.com, Pedro Tammela , Jamal Hadi Salim , Vlad Buslov , Peilin Ye , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 18/88] net/sched: sch_ingress: Only create under TC_H_INGRESS Date: Wed, 7 Jun 2023 22:15:35 +0200 Message-ID: <20230607200859.335342878@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607200854.030202132@linuxfoundation.org> References: <20230607200854.030202132@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Peilin Ye [ Upstream commit c7cfbd115001f94de9e4053657946a383147e803 ] ingress Qdiscs are only supposed to be created under TC_H_INGRESS. Return -EOPNOTSUPP if 'parent' is not TC_H_INGRESS, similar to mq_init(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: syzbot+b53a9c0d1ea4ad62da8b@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/0000000000006cf87705f79acf1a@google.com/ Tested-by: Pedro Tammela Acked-by: Jamal Hadi Salim Reviewed-by: Jamal Hadi Salim Reviewed-by: Vlad Buslov Signed-off-by: Peilin Ye Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_ingress.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index ce3f55259d0d1..2abc87a74ce40 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -83,6 +83,9 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt, struct ingress_sched_data *q = qdisc_priv(sch); struct net_device *dev = qdisc_dev(sch); + if (sch->parent != TC_H_INGRESS) + return -EOPNOTSUPP; + net_inc_ingress_queue(); mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); @@ -98,6 +101,9 @@ static void ingress_destroy(struct Qdisc *sch) { struct ingress_sched_data *q = qdisc_priv(sch); + if (sch->parent != TC_H_INGRESS) + return; + tcf_block_put_ext(q->block, sch, &q->block_info); net_dec_ingress_queue(); } -- 2.39.2