* [PATCH net] vsock: fix timeout in vsock_accept()
@ 2020-05-27 7:56 Stefano Garzarella
2020-05-27 8:44 ` Jorgen Hansen
2020-05-27 18:21 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Stefano Garzarella @ 2020-05-27 7:56 UTC (permalink / raw)
To: davem
Cc: George Zhang, Andy King, Dexuan Cui, Dmitry Torokhov, netdev,
Jorgen Hansen, Stefan Hajnoczi, linux-kernel, Jakub Kicinski
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: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
net/vmw_vsock/af_vsock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index a5f28708e0e7..626bf9044418 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -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 &&
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net] vsock: fix timeout in vsock_accept()
2020-05-27 7:56 [PATCH net] vsock: fix timeout in vsock_accept() Stefano Garzarella
@ 2020-05-27 8:44 ` Jorgen Hansen
2020-05-27 18:21 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jorgen Hansen @ 2020-05-27 8:44 UTC (permalink / raw)
To: 'Stefano Garzarella', davem
Cc: George Zhang, Andy King, Dexuan Cui, Dmitry Torokhov, netdev,
Stefan Hajnoczi, linux-kernel, Jakub Kicinski
> From: Stefano Garzarella <sgarzare@redhat.com>
> Sent: Wednesday, May 27, 2020 9:57 AM
>
> 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: d021c344051a ("VSOCK: Introduce VM Sockets")
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> net/vmw_vsock/af_vsock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index a5f28708e0e7..626bf9044418 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -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 &&
> --
> 2.25.4
Thanks for fixing this!
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] vsock: fix timeout in vsock_accept()
2020-05-27 7:56 [PATCH net] vsock: fix timeout in vsock_accept() Stefano Garzarella
2020-05-27 8:44 ` Jorgen Hansen
@ 2020-05-27 18:21 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-05-27 18:21 UTC (permalink / raw)
To: sgarzare
Cc: georgezhang, acking, decui, dtor, netdev, jhansen, stefanha,
linux-kernel, kuba
From: Stefano Garzarella <sgarzare@redhat.com>
Date: Wed, 27 May 2020 09:56:55 +0200
> 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: d021c344051a ("VSOCK: Introduce VM Sockets")
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Applied and queued up for -stable, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-27 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 7:56 [PATCH net] vsock: fix timeout in vsock_accept() Stefano Garzarella
2020-05-27 8:44 ` Jorgen Hansen
2020-05-27 18:21 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).