Skip to content

Commit 5cd6e0a

Browse files
matttbekuba-moo
authored andcommitted
mptcp: pm: ADD_ADDR rtx: fix potential data-race
This mptcp_pm_add_timer() helper is executed as a timer callback in softirq context. To avoid any data races, the socket lock needs to be held with bh_lock_sock(). If the socket is in use, retry again soon after, similar to what is done with the keepalive timer. Fixes: 00cfd77 ("mptcp: retransmit ADD_ADDR when timeout") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-3-fca8091060a4@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 03f324f commit 5cd6e0a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

net/mptcp/pm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
337337
if (inet_sk_state_load(sk) == TCP_CLOSE)
338338
return;
339339

340+
bh_lock_sock(sk);
341+
if (sock_owned_by_user(sk)) {
342+
/* Try again later. */
343+
sk_reset_timer(sk, timer, jiffies + HZ / 20);
344+
goto out;
345+
}
346+
340347
if (mptcp_pm_should_add_signal_addr(msk)) {
341348
sk_reset_timer(sk, timer, jiffies + TCP_RTO_MAX / 8);
342349
goto out;
@@ -365,6 +372,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
365372
mptcp_pm_subflow_established(msk);
366373

367374
out:
375+
bh_unlock_sock(sk);
368376
__sock_put(sk);
369377
}
370378

0 commit comments

Comments
 (0)