From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 707BDC43612 for ; Fri, 11 Jan 2019 15:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C5EF2084C for ; Fri, 11 Jan 2019 15:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547219198; bh=ELX33Hhr/D1RkN1qSEHRvPEG0RIpCE4PAe9uXyjL1WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=skP649y4tf1k71t98xrTX7vB5y2ZBQK1cXlDUw7SeGc/Dyt1h2WmOYR/BobWXoUXw ycoNbHkBNFP1Q4rNpr2bKRtd30mYQG1ZmtE/IeSfgLbMffsWcyzo7E2rwLqBNJbJQW tkzdA4BiprNo1fsOR6vlSqhURr5SwheR5PQOIwH8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388610AbfAKO2z (ORCPT ); Fri, 11 Jan 2019 09:28:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388581AbfAKO2v (ORCPT ); Fri, 11 Jan 2019 09:28:51 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E42B62177B; Fri, 11 Jan 2019 14:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216930; bh=ELX33Hhr/D1RkN1qSEHRvPEG0RIpCE4PAe9uXyjL1WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04hPQSrqb4wPjiPMPQ4+/hOWAwI9U2Is7150IOsqqZIW54YuZ3X8pL2Gbt1/GPczd 2NlNCjpM8HkJbImPEzanQtpHjDpuSNGjeCRgpfvORwhgfYQwRlyaCtQ2AjAuLsOh7j j8PhMIaM9A8oUcMJ+PUJUsX28C+CK68Lvo4/CGs4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Hajnoczi , "Michael S. Tsirkin" , Daniel Verkamp Subject: [PATCH 4.9 43/63] vhost/vsock: fix uninitialized vhost_vsock->guest_cid Date: Fri, 11 Jan 2019 15:14:46 +0100 Message-Id: <20190111131052.822007121@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131046.387528003@linuxfoundation.org> References: <20190111131046.387528003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Hajnoczi commit a72b69dc083a931422cc8a5e33841aff7d5312f2 upstream. 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 Cc: Daniel Verkamp Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/vsock.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -520,6 +520,8 @@ static int vhost_vsock_dev_open(struct i 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];