From: Stefan Hajnoczi Date: Thu, 9 Nov 2017 13:29:10 +0000 (+0000) Subject: vhost/vsock: fix uninitialized vhost_vsock->guest_cid X-Git-Tag: v4.19~1970^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a72b69dc083a931422cc8a5e33841aff7d5312f2;p=platform%2Fkernel%2Flinux-rpi3.git vhost/vsock: fix uninitialized vhost_vsock->guest_cid The vhost_vsock->guest_cid field is uninitialized when /dev/vhost-vsock is opened until the VHOST_VSOCK_SET_GUEST_CID ioctl is called. kvmalloc(..., GFP_KERNEL | __GFP_RETRY_MAYFAIL) does not zero memory. All other vhost_vsock fields are initialized explicitly so just initialize this field too. Signed-off-by: Stefan Hajnoczi Signed-off-by: Michael S. Tsirkin --- diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index c9de9c4..5a5e981 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -518,6 +518,8 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) goto out; } + vsock->guest_cid = 0; /* no CID assigned yet */ + atomic_set(&vsock->queued_replies, 0); vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX];