Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1943250imn; Mon, 1 Aug 2022 05:54:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ExIC7Icu6NxTAyP+iRfSRZOODYtzTW8om/90N3RMGKrtVTNGRCH0TrxWzbQRCB4CYroT+ X-Received: by 2002:a63:ba49:0:b0:41c:2713:3984 with SMTP id l9-20020a63ba49000000b0041c27133984mr3101429pgu.468.1659358482159; Mon, 01 Aug 2022 05:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358482; cv=none; d=google.com; s=arc-20160816; b=AsRRBaW+wUt+155XADXPcw3197b286k1mbE6db5mpxvnPzjWKSiiG3C2qjQ+PBKw90 qOwDPIOFj+S+FsfsfoPswuMfM2VIfuxjxkOaBfeUw7+9rJZV+tX1FRSUocKewq4lMI2r KRy69RZZndJBCUYXH5Yx8Iw/5ynoRmjkJ3OgH3uT4nOX61dJP2NABhBxAuCQiJU5Pn+X d5jE+nGqFI7GkFGy6AbuT3FU+LG74QgYxMEua8I1/ofw7KmrtQrVdK+lTg291cvYvIEg cRBLstCBFLypI/+oKhkd8P0Xy1cFYxxSXzRAC2dNlRBoDbjmyoAV8LgjlBVfR7nDUqZm nQdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YaHLkZg5/QWnp9tmZow4IFbIltCWKuXjOCFfpdS66Kg=; b=jtDWzNk7SvDGObv6055M4z1PWiTSZ2UUOkNraUznfaMhwLQ8A7PfafEc4Ua4e29pVs rwapEjMOPX8vuiL+yhe+/VxuIA6l7MaLONdZqIHWqB/1N/vtDNW5b/CYAht+PJH2hny0 ozdAOn/KWCknDnIOhSkUBtUFeZTZFHsSSxnPHrwSlUp6ESX1kRxY/nTFD9/NCxP134sQ 2S7bG6yC9e5wwxvC5tOlNgl2lMKMcOpmPxmxiL3B9E5FXPm5YEgNg8yH3RxQnssNvi0d ZbhCZ6PhuhrMODcEmCaxXo/Ivorhr0Ph01zsZqYZh5geA8qX3zlhmFCMakLIxW4zP8B7 tP8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="elb/vVZ6"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a63fb05000000b00419fc0f56a3si11415817pgh.89.2022.08.01.05.54.27; Mon, 01 Aug 2022 05:54:42 -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=@linuxfoundation.org header.s=korg header.b="elb/vVZ6"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232353AbiHALyh (ORCPT + 99 others); Mon, 1 Aug 2022 07:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbiHALyI (ORCPT ); Mon, 1 Aug 2022 07:54:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62F5F39BA8; Mon, 1 Aug 2022 04:50:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9128CB80E8F; Mon, 1 Aug 2022 11:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0539AC433D6; Mon, 1 Aug 2022 11:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354627; bh=4BYzN9ZsG6J5la9MVYv3agvx5TwtDX4EqT42ys/xm2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elb/vVZ6CWE8Bxete1dcVczv73g0qqHDqEb38SFU+eJE8Mk8fk/c2X8N3SvEvHmub ulCSw87myNyD7aKeJtO91MYWebi+Kl5pEHqKx1WPw8BMWzZvHIJlRsIFyo+YGW16UG LsdNNswyiv8YCFVRlkWN48+SOcbh1os15Hlk38Mc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 28/65] tcp: Fix a data-race around sysctl_tcp_autocorking. Date: Mon, 1 Aug 2022 13:46:45 +0200 Message-Id: <20220801114134.886903580@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114133.641770326@linuxfoundation.org> References: <20220801114133.641770326@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Kuniyuki Iwashima [ Upstream commit 85225e6f0a76e6745bc841c9f25169c509b573d8 ] While reading sysctl_tcp_autocorking, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: f54b311142a9 ("tcp: auto corking") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f1fd26bb199c..78460eb39b3a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -698,7 +698,7 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb, int size_goal) { return skb->len < size_goal && - sock_net(sk)->ipv4.sysctl_tcp_autocorking && + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_autocorking) && !tcp_rtx_queue_empty(sk) && refcount_read(&sk->sk_wmem_alloc) > skb->truesize; } -- 2.35.1