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 E2A5630AACA; Sun, 1 Mar 2026 01:48:04 +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=1772329685; cv=none; b=cmfl5atDGVtj0wJiZnFMum2M0f3CoWiSKfzE5lJOL6pjvGtYsOjoobOLwVnr3WARDjvrFlVHrYHAwntpiutpOzTJAWtkNOscEL5P8rXjn8gQHcrHXkzqkBc5n6vVOPHPxs27YljQgeLFUlIAYyEdsP4+zqb0qMUSO8oNlb5xb5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772329685; c=relaxed/simple; bh=r6mEPHl/++ecH7NomQxlYvn0mgbN0FqJfobDYnSEdu8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=c7RhsecoFGIyWAxkSP95xme7gGDd4vgKyJ7IJiAV1ZU1WiUPV2Ck04e42kiOXse/OSr7q+3hXCZnMjyvwVo7/ZcSnv+r3x3FZ2Uif33STjU5OZZIMpXCq2fI93+qM6ysu/jv83ER2j8aCjVtLbo/skUSYfew5nzkB5nF0mdzOno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ShJif7SI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ShJif7SI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB17C19421; Sun, 1 Mar 2026 01:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772329684; bh=r6mEPHl/++ecH7NomQxlYvn0mgbN0FqJfobDYnSEdu8=; h=From:To:Cc:Subject:Date:From; b=ShJif7SIgAjZiekpOwyj+xQTT7HcQPaNhYwcXkQUzopJ20PCH8CGkuhto9h67wutf enNiEMYLUy706s+VguPCIuYEllF1o4PoWSDIsMQkpTmZx+Sd7sr+OOoq0kwYF8CIHC tqnk3/nosSJQMIx90RTVOFoJXEmJyS4wn+If1CcCKZUv61kbRi9cllhs2eeqR5cU5Z 9oN+hkFKkZzJejOnS5jlri+yCv1s72P20OrMZdY822ntTS13qkptGw8pHjrxnS+ZH6 jJrd2XPL0yN9255JC291WjMPgC9ZuvcVis2u9TT15m3pJ07t1+UfZhCFqDvm0NcnzQ 45Uo3MfTsg5Cg== From: Sasha Levin To: stable@vger.kernel.org, cnitlrt@gmail.com Cc: Jakub Kicinski , netdev@vger.kernel.org Subject: FAILED: Patch "net/sched: act_skbedit: fix divide-by-zero in tcf_skbedit_hash()" failed to apply to 6.1-stable tree Date: Sat, 28 Feb 2026 20:48:02 -0500 Message-ID: <20260301014802.1712088-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From be054cc66f739a9ba615dba9012a07fab8e7dd6f Mon Sep 17 00:00:00 2001 From: Ruitong Liu Date: Sat, 14 Feb 2026 01:59:48 +0800 Subject: [PATCH] net/sched: act_skbedit: fix divide-by-zero in tcf_skbedit_hash() Commit 38a6f0865796 ("net: sched: support hash selecting tx queue") added SKBEDIT_F_TXQ_SKBHASH support. The inclusive range size is computed as: mapping_mod = queue_mapping_max - queue_mapping + 1; The range size can be 65536 when the requested range covers all possible u16 queue IDs (e.g. queue_mapping=0 and queue_mapping_max=U16_MAX). That value cannot be represented in a u16 and previously wrapped to 0, so tcf_skbedit_hash() could trigger a divide-by-zero: queue_mapping += skb_get_hash(skb) % params->mapping_mod; Compute mapping_mod in a wider type and reject ranges larger than U16_MAX to prevent params->mapping_mod from becoming 0 and avoid the crash. Fixes: 38a6f0865796 ("net: sched: support hash selecting tx queue") Cc: stable@vger.kernel.org # 6.12+ Signed-off-by: Ruitong Liu Link: https://patch.msgid.link/20260213175948.1505257-1-cnitlrt@gmail.com Signed-off-by: Jakub Kicinski --- net/sched/act_skbedit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 8c1d1554f6575..5450c1293eb50 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -126,7 +126,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, struct tcf_skbedit *d; u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL; u16 *queue_mapping = NULL, *ptype = NULL; - u16 mapping_mod = 1; + u32 mapping_mod = 1; bool exists = false; int ret = 0, err; u32 index; @@ -194,6 +194,10 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, } mapping_mod = *queue_mapping_max - *queue_mapping + 1; + if (mapping_mod > U16_MAX) { + NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid."); + return -EINVAL; + } flags |= SKBEDIT_F_TXQ_SKBHASH; } if (*pure_flags & SKBEDIT_F_INHERITDSFIELD) -- 2.51.0