]> git.baikalelectronics.ru Git - kernel.git/commit
sch_cake: avoid possible divide by zero in cake_enqueue()
authorWen Yang <wenyang@linux.alibaba.com>
Thu, 2 Jan 2020 09:21:43 +0000 (17:21 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jan 2020 00:34:28 +0000 (16:34 -0800)
commitba663b2c4a6957906df0f51a674fcbebf30cc914
treeb0ca5b68fbeda17f190305cdae73670591f7887a
parentc0e604027888f7b9bfc84f2a845e26f2dfbd499a
sch_cake: avoid possible divide by zero in cake_enqueue()

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: f35ebf840299 ("sch_cake: Add ingress mode")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: cake@lists.bufferbloat.net
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_cake.c