From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468Ab1BPUlF (ORCPT ); Wed, 16 Feb 2011 15:41:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60247 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754280Ab1BPUlD (ORCPT ); Wed, 16 Feb 2011 15:41:03 -0500 From: Alex Williamson Subject: [PATCH v2 2/2] intel-iommu: Fix get_domain_for_dev() error path To: dwmw2@infradead.org, iommu@lists.linux-foundation.org Cc: alex.williamson@redhat.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, ddutile@redhat.com, chrisw@redhat.com Date: Wed, 16 Feb 2011 13:40:08 -0700 Message-ID: <20110216204005.2979.51224.stgit@s20.home> In-Reply-To: <20110216203204.2979.13203.stgit@s20.home> References: <20110216203204.2979.13203.stgit@s20.home> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we run out of domain_ids and fail iommu_attach_domain(), we fall into domain_exit() without having setup enough of the domain structure for this to do anything useful. In fact, it typically runs off into the weeds walking the bogus domain->devices list. Just free the domain. Signed-off-by: Alex Williamson --- drivers/pci/intel-iommu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index b670b06..b0343d1 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -1835,7 +1835,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw) ret = iommu_attach_domain(domain, iommu); if (ret) { - domain_exit(domain); + free_domain_mem(domain); goto error; }