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 041FE1E9B06; Tue, 11 Mar 2025 15:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706768; cv=none; b=T1w26dy0/lasNGaLcNx69L70s4qofKH4/SKTEzA70yUFBfvzpGTyFhwHwubcISK0VBfljVCKsCF1RcJz59009O79u313SCxkQvUxJe8uTFdQeLy1PTmpz6/Ue0VwOYr+Y6Ae4F3Lmk4TyEiBmXhhk16Azqwlkj+5qKT2oOOI+n0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741706768; c=relaxed/simple; bh=6bqZwl7TB8vD3poVAe6YXOpzXj8epYYqnS147BX4zc0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nuTWPyqabGTo8OKjTHbgO0p8b2c8qJMMiRMrk2ttGXiadcQMHvetgkx//pLMeRM3mAdwNvUtcjypvVQrUAUeDTr6L400cq6C+UGZqCw27RH44GqctPAaocmvx2L2AaHSEaxh2RJeP1WD6OPXy0uGQMuEkRc/R/RkGBP93pn6yWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C6U4XwTr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="C6U4XwTr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FC2C4CEE9; Tue, 11 Mar 2025 15:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741706767; bh=6bqZwl7TB8vD3poVAe6YXOpzXj8epYYqnS147BX4zc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6U4XwTrIzlxOKG0L4uK72V644sRDUDi4oQh1FtWm6eFmsMUrnif7LXF+LE92dVDS gajAumQ8HlOTSLj7gbWxODEL7oTcJPEnoJr4uXMnfwDOWKGJw5DWkOfufl3qA2DEBJ uIsXA4E4yKYkLm902DegmJqPGnqczXdRki8SgXM0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Martin Ottens , Mingi Cho , Cong Wang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 161/462] netem: Update sch->q.qlen before qdisc_tree_reduce_backlog() Date: Tue, 11 Mar 2025 15:57:07 +0100 Message-ID: <20250311145804.703500753@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311145758.343076290@linuxfoundation.org> References: <20250311145758.343076290@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Wang [ Upstream commit 638ba5089324796c2ee49af10427459c2de35f71 ] qdisc_tree_reduce_backlog() notifies parent qdisc only if child qdisc becomes empty, therefore we need to reduce the backlog of the child qdisc before calling it. Otherwise it would miss the opportunity to call cops->qlen_notify(), in the case of DRR, it resulted in UAF since DRR uses ->qlen_notify() to maintain its active list. Fixes: f8d4bc455047 ("net/sched: netem: account for backlog updates from child qdisc") Cc: Martin Ottens Reported-by: Mingi Cho Signed-off-by: Cong Wang Link: https://patch.msgid.link/20250204005841.223511-4-xiyou.wangcong@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_netem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index f459e34684ad3..22f5d9421f6a6 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -739,9 +739,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch) if (err != NET_XMIT_SUCCESS) { if (net_xmit_drop_count(err)) qdisc_qstats_drop(sch); - qdisc_tree_reduce_backlog(sch, 1, pkt_len); sch->qstats.backlog -= pkt_len; sch->q.qlen--; + qdisc_tree_reduce_backlog(sch, 1, pkt_len); } goto tfifo_dequeue; } -- 2.39.5