]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/sched: cake: reject overhead values that underflow length
authorSamuel Moelius <sam.moelius@trailofbits.com>
Thu, 2 Jul 2026 00:07:59 +0000 (00:07 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Wed, 8 Jul 2026 09:42:21 +0000 (11:42 +0200)
commitb7f97cae7ec1b6c3c32843c42be218690d310467
tree5350e2160fa6de99543e1bb73f1451635b4665bc
parent5258b4fdae44cf5ac9b7c6fd71c9e0394a9fad5e
net/sched: cake: reject overhead values that underflow length

CAKE accepts signed overhead values and stores them in an s16, but the
adjusted packet length calculation uses unsigned arithmetic.  A negative
effective length can therefore wrap to a large value.

Such configurations make rate accounting depend on integer wraparound
rather than on the packet size userspace intended to model.  A static
netlink lower bound is not enough because packets reaching CAKE can be
smaller than any reasonable manual-overhead allowance.

Fold the signed overhead adjustment into the existing datapath MPU clamp
so negative adjusted lengths are clamped before link-layer framing
adjustments.

Fixes: a729b7f0bd5b ("sch_cake: Add overhead compensation support to the rate shaper")
Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20260702000758.297407.e5c888d9d99d.cake-overhead-underflow@trailofbits.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/sched/sch_cake.c