Article View: linux.kernel.netdev
Article #7101Re: [PATCH net-next v8 4/4] net/sched: cake: hash before segmenting and reject an overlong split
From: netdev-bot+sashiko
Date: Sat, 24 Oct 2026 17:30
Date: Sat, 24 Oct 2026 17:30
144 lines
13481 bytes
13481 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In cake_enqueue() (net/sched/sch_cake.c:1825-1827), the split-
GSO path drops the original skb with plain qdisc_drop() when…
- [Low] The commit message calls this patch a fix and describes a defect
that has been in released kernels since cake was merged: with…
--
net/sched: cake: hash before segmenting and reject an overlong split
This splits cake_hash() into two parts. cake_hash_keys() has no side
effects and runs on the unsegmented skb. cake_hash_resolve() runs only
once the packet is admitted.
Split-GSO segmentation now happens before the resolution. The summed
segment length is checked against QDISC_MAX_BACKLOG, and the whole list
is dropped if it is rejected. flow_mode is read once with READ_ONCE() so
that both halves use the same mode.
Link: https://lore.kernel.org/netdev/179231933068.3135.80340792633077986@kernel.org/
> The Fix:
> with CAKE_FLAG_SPLIT_GSO, cake computes the flow/host hash keys, then
> splits a GSO skb into segments it accounts individually. Key extraction
> must run on the unsegmented skb -- skb_gso_segment() can rewrite an
> encapsulated packet's headers to the inner ones -- and the resolution
> must wait until the packet is admitted, since it commits the
> set-associative tags, host indices and way counters that a later
> rejection would leave mutated (a GSO skb whose segmentation fails was
> dropped with that state already committed).
[ ... ]
> Link: https://lore.kernel.org/netdev/179231933068.3135.80340792633077986@kernel.org/
> Reviewed-by: Victor Nogueira <victor@mojatatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
[Severity: Low]
Should this have a Fixes: tag?
The commit message calls this a fix. The defect it describes has been in
released kernels for a long time. With CAKE_FLAG_SPLIT_GSO, cake_hash()
commits all of this before a failed skb_gso_segment() drops the packet:
- q->tags[]
- host tag and index assignments
- bulk count changes on the collision path
- the way_hits, way_misses and way_collisions counters
Blame on the baseline points to these two commits:
046f6fd5daef ("sched: Add Common Applications Kept Enhanced (cake) qdisc")
0c850344d388 ("sch_cake: Conditionally split GSO segments")
The overlong-split rejection only closes a gap opened by the earlier
"net/sched: cap the accounted backlog before it can wrap" patch in this
series, so that part doesn't need a Fixes: tag. The state-before-drop
ordering looks like it does.
> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 91c33295b30b4..79d6f6f76dbc8 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
[ ... ]
> @@ -1784,12 +1811,49 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> QDISC_DROP_OVERLIMIT);
> }
>
> - /* choose flow to insert into */
> + /* Select the tin and extract the keys before segmenting:
> + * skb_gso_segment() rewrites encapsulated headers, which
> + * changes the keys.
> + */
> b = cake_select_tin(sch, skb);
> - idx = cake_hash(b, skb, q->config->flow_mode, flow_override,
> - host_override) + 1;
> + cake_hash_keys(skb, flow_mode, flow_override, host_override, &keys);
> +
> + if (qdisc_pkt_segs(skb) > 1 && q->config->rate_flags & CAKE_FLAG_SPLIT_GSO) {
> + netdev_features_t features = netif_skb_features(skb);
> + struct sk_buff *nskb, *seg;
> +
> + segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
> + if (IS_ERR_OR_NULL(segs))
> + return qdisc_drop(skb, sch, to_free);
[Severity: Medium]
Can this qdisc_drop() report a bogus drop reason for the original skb?
__dev_xmit_skb() stores QDISC_DROP_GENERIC in tc_skb_cb(skb)->drop_reason,
which is at cb offset 32. __skb_gso_segment() then writes SKB_GSO_CB at
the same offset before it tries to segment:
net/core/gso.c:__skb_gso_segment() {
...
SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);
SKB_GSO_CB(skb)->encap_level = 0;
SKB_GSO_CB(skb)->recursion_counter = 0;
SKB_GSO_CB(skb)->max_segs = min(max_segs, U8_MAX);
...
segs = skb_mac_gso_segment(skb, features);
...
}
The cb is not restored when skb_mac_gso_segment() fails or returns NULL.
It can fail with -EINVAL for malformed headers, -EPROTONOSUPPORT when
there is no gso handler, or -ENOMEM from skb_segment().
The skb is then freed through this path:
qdisc_drop()->__qdisc_drop()->to_free->__tcf_kfree_skb_list()
__tcf_kfree_skb_list() reads the headroom value as drop_reason. That
value has no qdisc subsystem bits, so two things go wrong:
- trace_qdisc_drop is skipped
- kfree_skb_reason() gets an unrelated core skb_drop_reason equal to
the headroom
A headroom of 1 would even be reported as SKB_CONSUMED.
The commit message describes this aliasing, and the patch re-tags every
segment on the overlimit branch just below. The same qdisc_drop() was
already in the block before it was moved. Should this path use
qdisc_drop_reason(skb, sch, to_free, ...) with an explicit reason as
well?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-BA27.v8.r0.20261020063241%40mojatatu.com
Technical Details
Message-ID:
<179286304080.3134.13197757888201893950@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351434-linux-kernel-netdev=dewy.ruReferences:
<QDISC-BA27.v8.r0.20261020063241-4@mojatatu.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351434-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v8 4/4] net/sched: cake: hash before segmenting and reject an overlong split Date: Sat, 24 Oct 2026 17:30:40 +0000 Organization: Usenet Network Message-ID: <179286304080.3134.13197757888201893950@kernel.org> References: <QDISC-BA27.v8.r0.20261020063241-4@mojatatu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="819154"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:i1bh24roXIVK46KviACjr8BBHNE= sha256:g7mPcA7AmNnKTsEjqSnygG2fhXuL3TQ4nhZPQE9yAO4= sha1:HiP8PzZF/W8+xdncS2mKpMfhp4g= sha256:OJrG2P3xxwf6vVy1P0PJmzGf7T7Ll91KpRv6tcWhHqU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 4B3C8111693; Sat, 24 Oct 2026 20:31:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.738 X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xtcdSc6FVoXt; Sat, 24 Oct 2026 20:31:26 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351434-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B2F7111164C; Sat, 24 Oct 2026 20:31:17 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9319F37250; Sat, 24 Oct 2026 17:30:43 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792863043; b=slDEh+hRziLi+6MUQOtaMIi7RuJf9l22EO9ngK9CWeBkywv5OuCkcYhyTMPvmRn590BL AINTh+UCvr0pju44Y7/zNtRkucBoj0mAcRPnwiUa6+HgI7mWd+4p3Xa26ufcRNtIxoMC4 v4RQdV4T3/Bi0Kbscy62hYynEyHHDJUmMwAFu8N2IPSgs6wdg1w7A6D2F/3gJEoyfxt7Q PXgesVc6gXNZ8dDWUmiTYU0pO40/b2u84YUDQvB83N9pys34jWgyLFNoi30Sv4obhcDCy tQ9a2t6PiJ7mqBEKEVIddfjKu3XMENUjnidvvw+6BbigzrpR1Kzlq9WpH9u0oRh0Etw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792863043; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=hLJA0K15EYcYSs8KNBQ3DyMOiCMV9o1tX6RLGScLy1w=; b=AAs3hiKwRBAkOoQKQNQie4wvUxCKrj4oKojh7b0msgUhND80+I+DcnRs+ACo5ZaxqXQ3 ubZwa1AuuPpD/BzYf8ikXsrIEpQqGfodqXyYN7vydWhy5hWSAOUjCdGgaCQLr6bXOzGJl cL3FC8PJxHy2vj42VvKlLZim3nH/NSsORLAiBcypm/FVKqtOLJvTBArWajAuHgZE7Ceij Kkn0xKkmwZc2M77q3tYe0pxhAiWk/pDnmaYhOCYQUCSSYwpq9pwXPWDc7ka28JsjwJTa5 eWzc4gAXgUrwOnpiizQ3NxoHZSE9KkUIaNJ4Bjt7dB0mPbmrP0+9y9+nMWT9DPHKzEA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SVxQ2ZI0; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65625606A324; Sat, 24 Oct 2026 17:30:43 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SVxQ2ZI0 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792863042; b=OjDm+tNqriGSQZD938Plr8XnnsLrZzJEIQzjvboM/Jx7MEIo33dFgsSJVjNs3sNXbVxF K6At3asTNnH6rG4fQHKSKZULUWTCOXwF/GAsv68LX6/0RXrZPmNUvi7WR9UWRhXdHX6nU krkSzxddnwHj6e0wajq5UTCbaYnf8Vi8ZZ2z3j7UvaZSKv48DboiF8iFqhS8IUo/z5yKg zApppPOiDs7XpvUD7JOOM7mXB739Imc+uji9+WlM8IXfHXfPCsWPK72M43OdyQISY5r5F Od8dV56GdqwPQw0+3anzdNPXXtRHwi68qSo71vawn9V3pfLjxr4pVmygZCcG19/K18A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792863042; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=hLJA0K15EYcYSs8KNBQ3DyMOiCMV9o1tX6RLGScLy1w=; b=x1DYV9YsQ6NwvINR2oOxArPKVHNvpj1QmkdVWz/x8KdRr0SeMeXI5quSfmdUsL/Ckbb/ 6Bat+NeornUMoCKaXEUj0N+hBtZIMTG5TYcgGN+8xD1lPrNfgtV7/1d9tcPQHrv/s/vz8 3XhBOMjQv1zYQ4FTHw/W9VuIZ18qsR7spa32aVqKMQjCo+3Ld/tyxMeOKvqAR2aEd8bqE FsFPNXVivOaeGs4140OrMDk1RZnhcknaCXIrfNaGzNfMDu87GYQG4H7TSTnMFiJvxVgTS RaJjS77i21eTNu1QGYEPqxCEPoaANLUE0bn61JNovHqREbOAET5DILu640VfmLgEBcg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SVxQ2ZI0; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41BE9606A320 for <netdev@vger.kernel.org>; Sat, 24 Oct 2026 17:30:42 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BCA81F01825; Sat, 24 Oct 2026 17:30:41 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792863041; bh=hLJA0K15EYcYSs8KNBQ3DyMOiCMV9o1tX6RLGScLy1w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=SVxQ2ZI0VPhSxRTXjXutpNi2uKI8Z8DZ3L0rhLCgQN63yJn17GSW74s/rM+ec9gJ/ atXCat1iC5BAxl3FLahFpQchHgKgPs4peAPURlm7UZuAZjVswR5h3mYW5DlGYDssYf 2plKqxoheC55L7IeEowW9PGx8Nz0+TTlTXgcMExeSNXTw1+Yjh86+py632yy9Trtpy 5zYevl+DCjmVOjJWz0oZKSPRRO3ghGqwcUxNIOewvZnHa/eWEQGeASaNn7+ovKfnFT q9lZjVLXNj/LOrBFhSyO3zUW5TA46QNfokEfjppyJ43KWcy81juaHmniW1Ap4Z30Fc 1UlXWaj3yOIBA== X-Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, victor@mojatatu.com, toke@toke.dk, bjorn@kernel.org, sashiko-bot@kernel.org X-In-Reply-To: <QDISC-BA27.v8.r0.20261020063241-4@mojatatu.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list