From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1150651356C; Wed, 30 Sep 2026 18:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790791637; cv=none; b=NN8oDBZOA0kH+NTUMMhzrPlpQYPl4cVVS5u7n5DQEk52kplAsRDZ/dlRjYzui1B6YNir9X2d+XADOrefDqg+cmnrcUUsggxWZH9spCDXhaVNSVBxxfWuiUVeS8qKv4BOpFVQdD8rDvcpvapD0FYMOijRVRNtCC2FU7aRuiZpBfo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790791637; c=relaxed/simple; bh=BQjIISiUm925/UAzZU8MtyR0cV1iZmmtZZ/hIm7x8Nc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LfqMnlEx1nHs2acLl1R2xmQT6ooL7Tzqxbdl1qb3GSzjNCAvK6FDwqPNkYtqS+HlJ4Y/RiUplCW9PkbiSraqghTWqZyL79f/8D6kEQfmZn5bL+GY028xUJzllwnXjy4EvguFP0D0hFlsm2naxhLtBqAcOMlrfwwYeUnMQdkQIJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wMTv5Akb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wMTv5Akb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A0D01F000FF; Wed, 30 Sep 2026 18:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790791635; bh=53qKEmO8KkGyUcjuU9Q4YsC5vpU33fgiF98O5RfJLtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wMTv5Akb9+iqRrYbgpM+P/LLTt0FEdhQSN7dKItN/npz0+O0b7IMP1m+DMNlZ9/Xm HbpcQy/GxPe3kRVWs8EXuIwyTXzPHdRCt9qhcTi42s5iL/hXrbeNAIuUiHNgUJ2vbS YXCB3EDWF1SI2OUPgFWXqJ1joLoZr5L8S412y/Bg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vega , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Victor Nogueira , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 317/752] net/sched: sfq: clamp quantum in change path Date: Wed, 30 Sep 2026 17:23:07 +0200 Message-ID: <20260930152405.157170406@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152358.131179731@linuxfoundation.org> References: <20260930152358.131179731@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jamal Hadi Salim [ Upstream commit fb9f88a33c516ea5c0bcd9a22ca288b246b34567 ] sfq_change() accepts any non-negative quantum (only rejects (int)ctl->quantum < 0). With a crafted size table qdisc_pkt_len reaches ~2 GiB, so quantum=1 makes the deficit-refill loop spin ~2^31 times under the qdisc lock (a soft lockup / denial of service). Add max(256U, ...) matching fq_codel_change(). Reject quantum > 1<<20 with -EINVAL, matching fq_codel_change() and the init clamp. Conditions to recreate the bug: CONFIG_NET_SCH_SFQ=y. Requires CAP_NET_ADMIN (namespace-local via unshare -Urn suffices). tc qdisc add dev dummy0 root sfq tc qdisc change dev dummy0 root sfq quantum 1 stab data 32768 size_log 15 cell_log 0 Fixes: e4650d7ae425 ("net_sched: sch_sfq: handle bigger packets") Reported-by: Vega Reviewed-by: Toke Høiland-Jørgensen Tested-by: Victor Nogueira Signed-off-by: Jamal Hadi Salim Link: https://patch.msgid.link/QDISC-0CFC.v3.20260901204856@mojatatu.com.4 Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_sfq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 8ca88a4fedd0f..c017c0e6b1ebc 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -654,6 +654,11 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt, return -EINVAL; } + if (ctl->quantum > 1 << 20) { + NL_SET_ERR_MSG_MOD(extack, "quantum too large"); + return -EINVAL; + } + if (ctl->perturb_period < 0 || ctl->perturb_period > INT_MAX / HZ) { NL_SET_ERR_MSG_MOD(extack, "invalid perturb period"); @@ -682,7 +687,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt, /* update and validate configuration */ if (ctl->quantum) - quantum = ctl->quantum; + quantum = max(256U, ctl->quantum); if (ctl->flows) maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS); if (ctl->divisor) { -- 2.53.0