[Cake] Patch "sch_cake: avoid possible divide by zero in cake_enqueue()" has been added to the 5.4-stable tree
gregkh at linuxfoundation.org
gregkh at linuxfoundation.org
Sat Jan 11 03:18:11 EST 2020
This is a note to let you know that I've just added the patch titled
sch_cake: avoid possible divide by zero in cake_enqueue()
to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
sch_cake-avoid-possible-divide-by-zero-in-cake_enqueue.patch
and it can be found in the queue-5.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.
>From foo at baz Sat 11 Jan 2020 09:13:20 AM CET
From: Wen Yang <wenyang at linux.alibaba.com>
Date: Thu, 2 Jan 2020 17:21:43 +0800
Subject: sch_cake: avoid possible divide by zero in cake_enqueue()
From: Wen Yang <wenyang at linux.alibaba.com>
[ Upstream commit 68aab823c223646fab311f8a6581994facee66a0 ]
The variables 'window_interval' is u64 and do_div()
truncates it to 32 bits, which means it can test
non-zero and be truncated to zero for division.
The unit of window_interval is nanoseconds,
so its lower 32-bit is relatively easy to exceed.
Fix this issue by using div64_u64() instead.
Fixes: 7298de9cd725 ("sch_cake: Add ingress mode")
Signed-off-by: Wen Yang <wenyang at linux.alibaba.com>
Cc: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
Cc: Toke Høiland-Jørgensen <toke at redhat.com>
Cc: David S. Miller <davem at davemloft.net>
Cc: Cong Wang <xiyou.wangcong at gmail.com>
Cc: cake at lists.bufferbloat.net
Cc: netdev at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Acked-by: Toke Høiland-Jørgensen <toke at toke.dk>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
net/sched/sch_cake.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1769,7 +1769,7 @@ static s32 cake_enqueue(struct sk_buff *
q->avg_window_begin));
u64 b = q->avg_window_bytes * (u64)NSEC_PER_SEC;
- do_div(b, window_interval);
+ b = div64_u64(b, window_interval);
q->avg_peak_bandwidth =
cake_ewma(q->avg_peak_bandwidth, b,
b > q->avg_peak_bandwidth ? 2 : 8);
Patches currently in stable-queue which might be from wenyang at linux.alibaba.com are
queue-5.4/regulator-core-fix-regulator_register-error-paths-to.patch
queue-5.4/sch_cake-avoid-possible-divide-by-zero-in-cake_enqueue.patch
queue-5.4/regulator-fix-use-after-free-issue.patch
More information about the Cake
mailing list