From patchwork Tue Jul 29 10:07:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Paasch X-Patchwork-Id: 374396 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B60D91400FA for ; Tue, 29 Jul 2014 20:07:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbaG2KHl (ORCPT ); Tue, 29 Jul 2014 06:07:41 -0400 Received: from mail-we0-f182.google.com ([74.125.82.182]:63827 "EHLO mail-we0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbaG2KHh (ORCPT ); Tue, 29 Jul 2014 06:07:37 -0400 Received: by mail-we0-f182.google.com with SMTP id k48so8628507wev.41 for ; Tue, 29 Jul 2014 03:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=If39g+xIRY6qiAQRlr+Yn3OFjMCtJe6zZbUPM44Copw=; b=VLd4/mr/o3ofPwesnLDH1AfPvl7dyzkHXZfryzD8wew7WBih3QlhgL+SkYJMKLtpnE MJsZn7L6JRbqUMKO5MNcchc06N3L36qSskzbDH2p+XSXJxun6nmNjByLwZ1XIXM401Jb gTunFJhMGAcmn1+fp875BAVrxZLAt2/UKF2sikGXcB0pdlc7FXTlH29UaawEmXiNF9ne yyRlsfyFUKEWFIqFJJTvpzUtfUFiPLMxHBbHPriEyDTNYjrySXFqmmfO55X3C5xk017D DqYzn9svG9YASpiKVBJ9hs3US43uQGwN3P1uIAji1AJf0EfdkI8920PShqKkXA1rr9Ol 4OQQ== X-Received: by 10.194.78.4 with SMTP id x4mr1733992wjw.44.1406628453646; Tue, 29 Jul 2014 03:07:33 -0700 (PDT) Received: from localhost ([2001:6a8:3080:2:1d8a:c83d:42c:408a]) by mx.google.com with ESMTPSA id ub11sm41746785wib.1.2014.07.29.03.07.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Jul 2014 03:07:32 -0700 (PDT) From: Christoph Paasch To: David Miller Cc: netdev@vger.kernel.org, Christoph Paasch Subject: [PATCH RESUBMIT net] tcp: Fix integer-overflows in TCP veno Date: Tue, 29 Jul 2014 12:07:27 +0200 Message-Id: <1406628447-21130-1-git-send-email-christoph.paasch@uclouvain.be> X-Mailer: git-send-email 1.9.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In veno we do a multiplication of the cwnd and the rtt. This may overflow and thus their result is stored in a u64. However, we first need to cast the cwnd so that actually 64-bit arithmetic is done. A first attempt at fixing 76f1017757aa0 ([TCP]: TCP Veno congestion control) was made by 159131149c2 (tcp: Overflow bug in Vegas), but it failed to add the required cast in tcp_veno_cong_avoid(). Fixes: 76f1017757aa0 ([TCP]: TCP Veno congestion control) Signed-off-by: Christoph Paasch --- Notes: Resubmit as requested by David. net/ipv4/tcp_veno.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index 27b9825753d1..8276977d2c85 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c @@ -144,7 +144,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) rtt = veno->minrtt; - target_cwnd = (tp->snd_cwnd * veno->basertt); + target_cwnd = (u64)tp->snd_cwnd * veno->basertt; target_cwnd <<= V_PARAM_SHIFT; do_div(target_cwnd, rtt);