vhost-vsock: fix orphan connection reset
authorPeng Tao <bergwolf@gmail.com>
Thu, 8 Dec 2016 17:10:46 +0000 (01:10 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Dec 2016 02:24:30 +0000 (21:24 -0500)
local_addr.svm_cid is host cid. We should check guest cid instead,
which is remote_addr.svm_cid. Otherwise we end up resetting all
connections to all guests.

Cc: stable@vger.kernel.org [4.8+]
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/vsock.c

index e3b30ea9ece5945c935791798ab27ed8f6c3dd11..a504e2e003da58181e6fbf4e8276c8f4615e18f2 100644 (file)
@@ -506,7 +506,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk)
         * executing.
         */
 
-       if (!vhost_vsock_get(vsk->local_addr.svm_cid)) {
+       if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) {
                sock_set_flag(sk, SOCK_DONE);
                vsk->peer_shutdown = SHUTDOWN_MASK;
                sk->sk_state = SS_UNCONNECTED;