From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 73D663B2A4 for ; Sat, 11 Jan 2020 03:22:20 -0500 (EST) Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E28C22072E; Sat, 11 Jan 2020 08:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578730939; bh=Cq8pGCa3L32GWRrx40D4whFSkQlHj7QiBWr5pCmxgLw=; h=Subject:To:Cc:From:Date:From; b=1riTm8dhqkpqkk9uLE3fous+MW5nk2nTFgYCGmx57Zy1voNkBCycX0HZBeetEIXMf TAduvQnxgUi2uUBSGvcDFmPrb5yn7GPEzD6dvEr64b0o4SGK3JEqeaVo8aAVBecFvL 0eqMOTz46G/OpcMf9uakfGztqTCklx20VHboOu7U= To: cake@lists.bufferbloat.net, davem@davemloft.net, gregkh@linuxfoundation.org, ldir@darbyshire-bryant.me.uk, toke@redhat.com, toke@toke.dk, wenyang@linux.alibaba.com, xiyou.wangcong@gmail.com Cc: From: Date: Sat, 11 Jan 2020 09:18:11 +0100 Message-ID: <1578730691227219@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore Subject: [Cake] Patch "sch_cake: avoid possible divide by zero in cake_enqueue()" has been added to the 5.4-stable tree X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jan 2020 08:22:20 -0000 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 know about it. >From foo@baz Sat 11 Jan 2020 09:13:20 AM CET From: Wen Yang Date: Thu, 2 Jan 2020 17:21:43 +0800 Subject: sch_cake: avoid possible divide by zero in cake_enqueue() From: Wen Yang [ 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 Cc: Kevin Darbyshire-Bryant Cc: Toke Høiland-Jørgensen Cc: David S. Miller Cc: Cong Wang Cc: cake@lists.bufferbloat.net Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Toke Høiland-Jørgensen Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- 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@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