rxrpc: Fix sendmsg(MSG_WAITALL) handling
authorDavid Howells <dhowells@redhat.com>
Fri, 13 Mar 2020 17:30:27 +0000 (17:30 +0000)
committerDavid Howells <dhowells@redhat.com>
Fri, 13 Mar 2020 23:04:34 +0000 (23:04 +0000)
Fix the handling of sendmsg() with MSG_WAITALL for userspace to round the
timeout for when a signal occurs up to at least two jiffies as a 1 jiffy
timeout may end up being effectively 0 if jiffies wraps at the wrong time.

Fixes: bc5e3a546d55 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals")
Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/sendmsg.c

index 1eccfb9..0fcf157 100644 (file)
@@ -71,8 +71,8 @@ static int rxrpc_wait_for_tx_window_waitall(struct rxrpc_sock *rx,
 
        rtt = READ_ONCE(call->peer->rtt);
        rtt2 = nsecs_to_jiffies64(rtt) * 2;
-       if (rtt2 < 1)
-               rtt2 = 1;
+       if (rtt2 < 2)
+               rtt2 = 2;
 
        timeout = rtt2;
        tx_start = READ_ONCE(call->tx_hard_ack);