diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-12-06 15:39:12 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-04 19:13:36 +0100 |
commit | c483ef739b08186279501008ce939e5a3e2842f8 (patch) | |
tree | d7e17180426947eff1d3c1c7501a69cb6c1d65e1 /drivers/vhost | |
parent | 4840b6a7480b92c0942c10c5db803c67bf3ef9c6 (diff) | |
download | linux-stable-c483ef739b08186279501008ce939e5a3e2842f8.tar.gz linux-stable-c483ef739b08186279501008ce939e5a3e2842f8.tar.bz2 linux-stable-c483ef739b08186279501008ce939e5a3e2842f8.zip |
vhost/vsock: accept only packets with the right dst_cid
[ Upstream commit 8a3cc29c316c17de590e3ff8b59f3d6cbfd37b0a ]
When we receive a new packet from the guest, we check if the
src_cid is correct, but we forgot to check the dst_cid.
The host should accept only packets where dst_cid is
equal to the host CID.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vsock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 8dcee4faf701..5f5c5de31f10 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -436,7 +436,9 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) virtio_transport_deliver_tap_pkt(pkt); /* Only accept correctly addressed packets */ - if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid) + if (le64_to_cpu(pkt->hdr.src_cid) == vsock->guest_cid && + le64_to_cpu(pkt->hdr.dst_cid) == + vhost_transport_get_local_cid()) virtio_transport_recv_pkt(pkt); else virtio_transport_free_pkt(pkt); |