]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vsock: fix timeout in vsock_accept()
authorStefano Garzarella <sgarzare@redhat.com>
Wed, 27 May 2020 07:56:55 +0000 (09:56 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 May 2020 18:20:23 +0000 (11:20 -0700)
The accept(2) is an "input" socket interface, so we should use
SO_RCVTIMEO instead of SO_SNDTIMEO to set the timeout.

So this patch replace sock_sndtimeo() with sock_rcvtimeo() to
use the right timeout in the vsock_accept().

Fixes: 031acdb8ab77 ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/af_vsock.c

index a5f28708e0e75402e595a38ee91c57e9637e0289..626bf9044418cc78eef4da904334f5dfc87b458c 100644 (file)
@@ -1408,7 +1408,7 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, int flags,
        /* Wait for children sockets to appear; these are the new sockets
         * created upon connection establishment.
         */
-       timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
+       timeout = sock_rcvtimeo(listener, flags & O_NONBLOCK);
        prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
 
        while ((connected = vsock_dequeue_accept(listener)) == NULL &&