Re: [PATCH net] mptcp: fix soft lockup in mptcp_recvmsg()
From: Li Xiasong
Date: Wed Mar 04 2026 - 06:33:36 EST
Hi Paolo,
On 3/4/2026 5:07 PM, Paolo Abeni wrote:
> On 3/2/26 6:26 AM, Li Xiasong wrote:
>> @@ -2343,7 +2347,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
>>
>> pr_debug("block timeout %ld\n", timeo);
>> mptcp_cleanup_rbuf(msk, copied);
>> - err = sk_wait_data(sk, &timeo, NULL);
>> + err = sk_wait_data(sk, &timeo, last);
>
> Isn't
> err = sk_wait_data(sk, &timeo, skb_peek_tail(&sk->sk_receive_queue));
>
> Enough?
Thanks for the review! In the general case, letting sk_wait_data block is
correct. The exception is within __mptcp_recvmsg_mskq, where a failure in
skb_copy_datagram_msg will cause a break in the consumption loop. This
leaves the actual processing position inconsistent with
skb_peek_tail(&sk->sk_receive_queue), and at that point, we must not wait.
>
> Also, could you please add a paired tests-case? Thanks!
>
Further to our discussion, a minimal reproduction case for this scenario is
available here:
https://lore.kernel.org/netdev/e91bf909-bf4d-4f90-a370-688a9424478b@xxxxxxxxxx/
When running the reproduced program, you can observe the server's sy
(system) CPU usage hitting 100%.
Thanks,
Li Xiasong