From patchwork Wed Jun 12 00:35:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raphael Norwitz X-Patchwork-Id: 1114246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45NpJ35QNjz9s6w for ; Wed, 12 Jun 2019 10:52:46 +1000 (AEST) Received: from localhost ([::1]:55982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1harVI-0006Jd-B0 for incoming@patchwork.ozlabs.org; Tue, 11 Jun 2019 20:52:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46849) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1harUf-0006EY-PZ for qemu-devel@nongnu.org; Tue, 11 Jun 2019 20:52:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1harMb-0004xP-6s for qemu-devel@nongnu.org; Tue, 11 Jun 2019 20:43:42 -0400 Received: from [192.146.154.1] (port=33243 helo=mcp01.nutanix.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1harMb-0004wx-1V for qemu-devel@nongnu.org; Tue, 11 Jun 2019 20:43:41 -0400 Received: from raphael-norwitz.dev.nutanix.com (unknown [10.41.25.241]) by mcp01.nutanix.com (Postfix) with ESMTP id 849E1100941A; Wed, 12 Jun 2019 00:35:20 +0000 (UTC) From: Raphael Norwitz To: qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 17:35:17 -0700 Message-Id: <1560299717-177734-1-git-send-email-raphael.norwitz@nutanix.com> X-Mailer: git-send-email 1.9.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.146.154.1 Subject: [Qemu-devel] [PATCH] vhost-user-scsi: prevent using uninitialized vqs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Paolo Bonzini , "Michael S. Tsirkin" , Raphael Norwitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs: qemu-system-x86_64: Unable to map available ring for ring 0 qemu-system-x86_64: Verify ring failure on region 0 The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices. Signed-off-by: Raphael Norwitz Reviewed-by: Stefan Hajnoczi --- hw/scsi/vhost-user-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index a9fd8ea..e4aae95 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -91,7 +91,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp) } vsc->dev.nvqs = 2 + vs->conf.num_queues; - vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs); + vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs); vsc->dev.vq_index = 0; vsc->dev.backend_features = 0; vqs = vsc->dev.vqs;