]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/vhost-vsock-fix-uninitialized-vhost_vsock-guest_cid.patch
Linux 4.19.15
[thirdparty/kernel/stable-queue.git] / queue-4.14 / vhost-vsock-fix-uninitialized-vhost_vsock-guest_cid.patch
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
5
6 From: Stefan Hajnoczi <stefanha@redhat.com>
7
8 commit a72b69dc083a931422cc8a5e33841aff7d5312f2 upstream.
9
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.
12
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.
16
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>
21
22 ---
23 drivers/vhost/vsock.c | 2 ++
24 1 file changed, 2 insertions(+)
25
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
29 goto out;
30 }
31
32 + vsock->guest_cid = 0; /* no CID assigned yet */
33 +
34 atomic_set(&vsock->queued_replies, 0);
35
36 vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX];