aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Barber <smbarber@chromium.org>2019-06-14 23:42:37 -0700
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:31 -0400
commit9abf13c7914f7a4755a13601f4795b7505271a3d (patch)
treec7fc692355fbd532e24d0bfd1173bdfe591794eb
parentecb028345d6494f66f45384f194c95a81fda3e5e (diff)
downloadlinux-yocto-9abf13c7914f7a4755a13601f4795b7505271a3d.tar.gz
linux-yocto-9abf13c7914f7a4755a13601f4795b7505271a3d.tar.bz2
linux-yocto-9abf13c7914f7a4755a13601f4795b7505271a3d.zip
vsock/virtio: set SOCK_DONE on peer shutdown
commit 42f5cda5eaf4396a939ae9bb43bb8d1d09c1b15c upstream. Set the SOCK_DONE flag to match the TCP_CLOSING state when a peer has shut down and there is nothing left to read. This fixes the following bug: 1) Peer sends SHUTDOWN(RDWR). 2) Socket enters TCP_CLOSING but SOCK_DONE is not set. 3) read() returns -ENOTCONN until close() is called, then returns 0. Signed-off-by: Stephen Barber <smbarber@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--net/vmw_vsock/virtio_transport_common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index f3f3d06cb6d8..e30f53728725 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -871,8 +871,10 @@ virtio_transport_recv_connected(struct sock *sk,
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SHUTDOWN_SEND)
vsk->peer_shutdown |= SEND_SHUTDOWN;
if (vsk->peer_shutdown == SHUTDOWN_MASK &&
- vsock_stream_has_data(vsk) <= 0)
+ vsock_stream_has_data(vsk) <= 0) {
+ sock_set_flag(sk, SOCK_DONE);
sk->sk_state = TCP_CLOSING;
+ }
if (le32_to_cpu(pkt->hdr.flags))
sk->sk_state_change(sk);
break;