Skip to content

Commit

Permalink
mptcp: Safely read sequence number when lock isn't held
Browse files Browse the repository at this point in the history
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 <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mat Martineau authored and David S. Miller committed Jul 29, 2020
1 parent 06827b3 commit c752939
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c752939

Please sign in to comment.