diff mbox series

[mptcp-next,v4,12/12] mptcp: Safely store sequence number when sending data

Message ID 20200724011127.363638-13-mathew.j.martineau@linux.intel.com
State Accepted, archived
Delegated to: Matthieu Baerts
Headers show
Series DATA_FIN support | expand

Commit Message

Mat Martineau July 24, 2020, 1:11 a.m. UTC
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 <mathew.j.martineau@linux.intel.com>
---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 65aa2b9df721..5d992f78e6bf 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;