Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2964040rwi; Fri, 21 Oct 2022 09:48:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42vkhyNUMCF1UPIwaLPd8rPh+HiCz7v0ogfX/KvzYbtKR+WriqDmgsVny8Dx/KWU4dvhfn X-Received: by 2002:a05:6402:51d1:b0:45d:b498:169 with SMTP id r17-20020a05640251d100b0045db4980169mr18531844edd.119.1666370916840; Fri, 21 Oct 2022 09:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666370916; cv=none; d=google.com; s=arc-20160816; b=XE4TN+o/t+/zfIn+/vXFP/2QjRZmukTvMXtAiwwdHsLeO+IbcQF3cSEI4yAiLzS4bw k0LW+hR3Iy/GZSYdIYwQ6cVtupgZZAiEfddiJQmF2q4r88gWkk8Mz+LrizlbS/mFZoOq rLhgpJpqUdDVtkti/+woDqW2bavVwy9voafpFYyEKbpW0HjpeK2T95ll3JHsZN6G/s0Q nwvHUR/z1Si9enNIccglkrPTNMUCoS3KPg1e/IxA468OnDmi6TM5F+FUTNcbVllRXNtK NMCMrxOGRJHNsqFqtP36oAnfy0jUNedD0F3nG+7fuVGWbuPJIVeVraqdSgHJwnmHABc4 urhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QFj00Pytc1eVtk5kxWQzFS9bf1Zt+kboGQFUu9iOLCY=; b=OX3KoRrtgHdYlbd4vPGMzNYYrngP6ZL/b0Trh81uK8l5Zz24MgSxMyWumP3l2+2ItU fPRSE/B9gJAnxDGGAu4h2imh3UAWMFMwgvhXfy1FAE0PNKlOb/aJDfHJVyGoJoP8WTg9 apPVQle58ciNekrEgb+KbAQgzJKv7yL3to/8PykewTDGRZeDZK9PYoTr6VTNuOSweBbX tHUHMU7rTu5M0cOF+140728ZjF//Ux56m+lN1ntguN1u0UuQVezcnlmcaU/be30oanc1 EYAdmysCxUdyZUFOcrZIIgI5Kwd9QoHxv17UHgZzj7Jda5HOq2jS+ibJCC35rh3/EnK4 FWqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=blMCRxL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170906974b00b0077d1df3967asi12001533ejy.563.2022.10.21.09.48.07; Fri, 21 Oct 2022 09:48:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=blMCRxL8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbiJUQB7 (ORCPT + 99 others); Fri, 21 Oct 2022 12:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiJUQB5 (ORCPT ); Fri, 21 Oct 2022 12:01:57 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A77BB27211F for ; Fri, 21 Oct 2022 09:01:41 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id y72so3808638yby.13 for ; Fri, 21 Oct 2022 09:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QFj00Pytc1eVtk5kxWQzFS9bf1Zt+kboGQFUu9iOLCY=; b=blMCRxL83xZvPorKkb258kqBGV3yOjTV223sbCqOZEW/FqDCYKdFJCIDfKYnjtci0b 5OCBCZbAnOmLoHzqtYU6C9+L19aZ91UeDMCqkVnaev5R5AJseFQkMUMvSJUtcORNHJcp red3TSWbYa2+dwPdgk9HXvAAenhWIDP89wGcZsZJ/nVxfHxKtbpiKtsyP3pgcM0eNe5n 96empZlfTZZlxeQaogqSZQLfg/PP0Bg53dvvp9zHRswkTSgKDFxKN2gSFdNRjb7V/em5 B5OKAbBMwBM/G6VoSH2Gj1VDlPLDBS+lVopx202o3+PPj66HcipjN4DO91HBYdghgxv6 +OrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QFj00Pytc1eVtk5kxWQzFS9bf1Zt+kboGQFUu9iOLCY=; b=Pr+oZnDB8KesMOVXcmxdcW7PRxB98Pgf4fZPRR1iGgQ4YQIS+9ykIjZEVvvFlu6qMb xG4L56OI/pKEGBhI7h2EK9G1eDGORkoNp7KdgoWIrfs1UPxn49prJvzHdoqxxQECXWEe YA7tKYV24G0o22dnGtr9q/wLrkbn/HDc9gNYrngxbEHq43z+WND7J0qXy458LXT/SibK 4ifx/l16AKa226irnXabA5vEr9C0TzIQD7JsZUa9AFvwflnL4C8RshWaIUi9qXkXcko3 dr6vDZtdzitI/maN6Zt1LWQr+G0qZL1m5LkwWJY0X91AGhXUX0vRLJyghmom7zooQ4Au 0o/A== X-Gm-Message-State: ACrzQf0MP1NprJ7lmEwrcr4zdhdBsKpDYV3O5tG2E/iW5BRTJjyei9Aa 6G+t3d+IqIGv5+cd4IlR9pX1hvHPknJdL/qsSP4x7A== X-Received: by 2002:a25:ab2c:0:b0:6ca:1f6e:da97 with SMTP id u41-20020a25ab2c000000b006ca1f6eda97mr10150236ybi.231.1666368100015; Fri, 21 Oct 2022 09:01:40 -0700 (PDT) MIME-Version: 1.0 References: <20221021040622.815143-1-luwei32@huawei.com> In-Reply-To: <20221021040622.815143-1-luwei32@huawei.com> From: Eric Dumazet Date: Fri, 21 Oct 2022 09:01:28 -0700 Message-ID: Subject: Re: [PATCH net,v3] tcp: fix a signed-integer-overflow bug in tcp_add_backlog() To: Lu Wei Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org, ast@kernel.org, martin.lau@kernel.org, kuniyu@amazon.com, asml.silence@gmail.com, imagedong@tencent.com, ncardwell@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 20, 2022 at 8:03 PM Lu Wei wrote: > > The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and > in tcp_add_backlog(), the variable limit is caculated by adding > sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value > of int and overflow. This patch reduces the limit budget by > halving the sndbuf to solve this issue since ACK packets are much > smaller than the payload. > > Fixes: c9c3321257e1 ("tcp: add tcp_add_backlog()") > Signed-off-by: Lu Wei Reviewed-by: Eric Dumazet