From patchwork Tue Jul 28 22:12:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 1338053 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGWBR1jXfz9sRN for ; Wed, 29 Jul 2020 08:12:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729884AbgG1WMa (ORCPT ); Tue, 28 Jul 2020 18:12:30 -0400 Received: from mga02.intel.com ([134.134.136.20]:2589 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729803AbgG1WMT (ORCPT ); Tue, 28 Jul 2020 18:12:19 -0400 IronPort-SDR: k4U9Fc9eHJRR4tObEbc7t3ajdMvShqozXqBzytrHci9aloHMvfVRq9qrokKuVUMBHpaQpxindX 3elGI+Rtz5tg== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="139342697" X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="139342697" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 15:12:16 -0700 IronPort-SDR: TpyjGIMfIRPaU/Bn42UCdEMrhbGOToSoN2WmTfSjDQrSaQFcZgadxU+V+IiZe6Vz9N4s8fqLYB pDTOs+OGCr0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,408,1589266800"; d="scan'208";a="328468899" Received: from mjmartin-nuc02.amr.corp.intel.com ([10.254.116.118]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jul 2020 15:12:16 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Mat Martineau , mptcp@lists.01.org, matthieu.baerts@tessares.net, pabeni@redhat.com Subject: [PATCH net-next 12/12] mptcp: Safely store sequence number when sending data Date: Tue, 28 Jul 2020 15:12:10 -0700 Message-Id: <20200728221210.92841-13-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200728221210.92841-1-mathew.j.martineau@linux.intel.com> References: <20200728221210.92841-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The MPTCP socket's write_seq member can be read without the msk lock held, so use WRITE_ONCE() to store it. Signed-off-by: Mat Martineau --- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f2455a68d231..687f0bea2b35 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -793,7 +793,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, out: if (!retransmission) pfrag->offset += frag_truesize; - *write_seq += ret; + WRITE_ONCE(*write_seq, *write_seq + ret); mptcp_subflow_ctx(ssk)->rel_write_seq += ret; return ret;