From: Mat Martineau Date: Tue, 28 Jul 2020 22:12:09 +0000 (-0700) Subject: mptcp: Safely read sequence number when lock isn't held X-Git-Tag: x86-urgent-2020-08-15~21^2~110^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c75293925f24630326abdf79751d980ec3878f65;p=users%2Fdwmw2%2Flinux.git mptcp: Safely read sequence number when lock isn't held The MPTCP socket's write_seq member should be read with READ_ONCE() when the msk lock is not held. Signed-off-by: Mat Martineau Signed-off-by: David S. Miller --- diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f264ea15e081b..f2455a68d2315 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1269,7 +1269,7 @@ static void mptcp_retransmit_handler(struct sock *sk) { struct mptcp_sock *msk = mptcp_sk(sk); - if (atomic64_read(&msk->snd_una) == msk->write_seq) { + if (atomic64_read(&msk->snd_una) == READ_ONCE(msk->write_seq)) { mptcp_stop_timer(sk); } else { set_bit(MPTCP_WORK_RTX, &msk->flags);