From patchwork Wed Mar 27 21:59:46 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: 2353451 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3F540E00E6 for ; Wed, 27 Mar 2013 22:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752Ab3C0WKz (ORCPT ); Wed, 27 Mar 2013 18:10:55 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:58235 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754760Ab3C0WKx (ORCPT ); Wed, 27 Mar 2013 18:10:53 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id E6AC822D9D5; Wed, 27 Mar 2013 21:59:50 +0000 (UTC) From: "Nicholas A. Bellinger" To: target-devel Cc: lf-virt , kvm-devel , qemu-devel , "Michael S. Tsirkin" , Stefan Hajnoczi , Paolo Bonzini , Asias He , Anthony Liguori , Nicholas Bellinger Subject: [PATCH 3/3] vhost: Only call vhost_verify_ring_mappings when adding vhost memory Date: Wed, 27 Mar 2013 21:59:46 +0000 Message-Id: <1364421586-29857-4-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1364421586-29857-1-git-send-email-nab@linux-iscsi.org> References: <1364421586-29857-1-git-send-email-nab@linux-iscsi.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nicholas Bellinger This patch fixes a bug where vhost_verify_ring_mappings() could be called after vhost_dev_unassign_memory() has been called during vhost_set_memory(..., add=false). This appears to be fallout from when dev->started = true assignment occurs before vhost_set_memory(..., add=false) is called in: commit 24f4fe345c1b80bab1ee18573914123d8028a9e6 Author: Michael S. Tsirkin Date: Tue Dec 25 17:41:07 2012 +0200 vhost: set started flag while start is in progress Cc: Michael S. Tsirkin Cc: Asias He Cc: Paolo Bonzini Signed-off-by: Nicholas Bellinger --- hw/vhost.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/vhost.c b/hw/vhost.c index 4d6aee3..687a689 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -421,7 +421,7 @@ static void vhost_set_memory(MemoryListener *listener, return; } - if (dev->started) { + if (dev->started && add) { r = vhost_verify_ring_mappings(dev, start_addr, size); assert(r >= 0); }