1 From a72b69dc083a931422cc8a5e33841aff7d5312f2 Mon Sep 17 00:00:00 2001
2 From: Stefan Hajnoczi <stefanha@redhat.com>
3 Date: Thu, 9 Nov 2017 13:29:10 +0000
4 Subject: vhost/vsock: fix uninitialized vhost_vsock->guest_cid
6 From: Stefan Hajnoczi <stefanha@redhat.com>
8 commit a72b69dc083a931422cc8a5e33841aff7d5312f2 upstream.
10 The vhost_vsock->guest_cid field is uninitialized when /dev/vhost-vsock
11 is opened until the VHOST_VSOCK_SET_GUEST_CID ioctl is called.
13 kvmalloc(..., GFP_KERNEL | __GFP_RETRY_MAYFAIL) does not zero memory.
14 All other vhost_vsock fields are initialized explicitly so just
15 initialize this field too.
17 Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
18 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
19 Cc: Daniel Verkamp <dverkamp@chromium.org>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 drivers/vhost/vsock.c | 2 ++
24 1 file changed, 2 insertions(+)
26 --- a/drivers/vhost/vsock.c
27 +++ b/drivers/vhost/vsock.c
28 @@ -522,6 +522,8 @@ static int vhost_vsock_dev_open(struct i
32 + vsock->guest_cid = 0; /* no CID assigned yet */
34 atomic_set(&vsock->queued_replies, 0);
36 vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX];