From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXY0Y-0008WO-P0 for qemu-devel@nongnu.org; Tue, 08 Apr 2014 11:32:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXY0T-0005p5-5T for qemu-devel@nongnu.org; Tue, 08 Apr 2014 11:32:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXY0S-0005ot-TY for qemu-devel@nongnu.org; Tue, 08 Apr 2014 11:32:13 -0400 Date: Tue, 8 Apr 2014 18:32:39 +0300 From: "Michael S. Tsirkin" Message-ID: <20140408153239.GB8087@redhat.com> References: <1396502304-7456-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1396502304-7456-1-git-send-email-arei.gonglei@huawei.com> Subject: Re: [Qemu-devel] [PATCH 1/2] pci-assign: Fix a bug when map MSI-X table memory failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: weidong.huangwei@huawei.com, pbonzini@redhat.com, alex.williamson@redhat.com, qemu-devel@nongnu.org On Thu, Apr 03, 2014 at 01:18:23PM +0800, arei.gonglei@huawei.com wrote: > From: Gonglei > > when map MSI-X table memory failed, the dev->msix_table not be > set to NULL, the assigned_dev_unregister_msix_mmio() will case > a segfault when munmap the failed dev->msix_table. > > Signed-off-by: Gonglei Reviewed-by: Michael S. Tsirkin > --- > hw/i386/kvm/pci-assign.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c > index a825871..570333f 100644 > --- a/hw/i386/kvm/pci-assign.c > +++ b/hw/i386/kvm/pci-assign.c > @@ -1608,6 +1608,7 @@ static int assigned_dev_register_msix_mmio(AssignedDevice *dev) > MAP_ANONYMOUS|MAP_PRIVATE, 0, 0); > if (dev->msix_table == MAP_FAILED) { > error_report("fail allocate msix_table! %s", strerror(errno)); > + dev->msix_table = NULL; > return -EFAULT; > } > > -- > 1.7.12.4 > >