From patchwork Fri Mar 29 04:33:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 232285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4F9912C00BB for ; Fri, 29 Mar 2013 15:44:54 +1100 (EST) Received: from localhost ([::1]:47759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULRBM-0000Mm-Io for incoming@patchwork.ozlabs.org; Fri, 29 Mar 2013 00:44:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULRAv-0000F4-7Q for qemu-devel@nongnu.org; Fri, 29 Mar 2013 00:44:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULRAt-0004h9-Qy for qemu-devel@nongnu.org; Fri, 29 Mar 2013 00:44:25 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:48521 helo=linux-iscsi.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULRAt-0004h5-La for qemu-devel@nongnu.org; Fri, 29 Mar 2013 00:44:23 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id BAB3822D9D1; Fri, 29 Mar 2013 04:33:18 +0000 (UTC) From: "Nicholas A. Bellinger" To: target-devel Date: Fri, 29 Mar 2013 04:33:12 +0000 Message-Id: <1364531592-8368-4-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1364531592-8368-1-git-send-email-nab@linux-iscsi.org> References: <1364531592-8368-1-git-send-email-nab@linux-iscsi.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 67.23.28.174 Cc: kvm-devel , "Michael S. Tsirkin" , qemu-devel , Nicholas Bellinger , lf-virt , Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini , Asias He Subject: [Qemu-devel] [PATCH 3/3] vhost: Check+skip uninitialized VQs in vhost_verify_ring_mappings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Nicholas Bellinger With the virtio_queue_valid() checks in place to skip uninitialized VQs within virtio-pci code, go ahead and skip the same uninitialized VQs during vhost_verify_ring_mappings(). Note this patch does not prevent vhost_virtqueue_start() from executing by checking virtio_queue_valid(), as other logic during seabios -> virtio-scsi LLD guest hand-off appears to depend upon this execution. Cc: Michael S. Tsirkin Cc: Asias He Cc: Paolo Bonzini Signed-off-by: Nicholas Bellinger --- hw/vhost.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/vhost.c b/hw/vhost.c index 4d6aee3..3a71aee 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -314,6 +314,9 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev, hwaddr l; void *p; + if (!vq->ring_phys || !vq->ring_size) { + continue; + } if (!ranges_overlap(start_addr, size, vq->ring_phys, vq->ring_size)) { continue; }