From: Kevin Mitchell <kevmitch@arista.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Kevin Mitchell <kevmitch@arista.com>
Subject: [PATCH 1/3] iommu/amd: make iommu_disable safer
Date: Wed, 12 Jun 2019 14:52:03 -0700 [thread overview]
Message-ID: <20190612215203.12711-2-kevmitch@arista.com> (raw)
In-Reply-To: <20190612215203.12711-1-kevmitch@arista.com>
Make it safe to call iommu_disable during early init error conditions
before mmio_base is set, but after the struct amd_iommu has been added
to the amd_iommu_list. For example, this happens if firmware fails to
fill in mmio_phys in the ACPI table leading to a NULL pointer
dereference in iommu_feature_disable.
Signed-off-by: Kevin Mitchell <kevmitch@arista.com>
---
drivers/iommu/amd_iommu_init.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index f773792d77fd..3798d7303c99 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -424,6 +424,9 @@ static void iommu_enable(struct amd_iommu *iommu)
static void iommu_disable(struct amd_iommu *iommu)
{
+ if (!iommu->mmio_base)
+ return;
+
/* Disable command buffer */
iommu_feature_disable(iommu, CONTROL_CMDBUF_EN);
--
2.20.1
next prev parent reply other threads:[~2019-06-13 17:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 21:52 [PATCH 0/3] handle init errors more gracefully in amd_iommu Kevin Mitchell
2019-06-12 21:52 ` Kevin Mitchell [this message]
2019-06-12 21:52 ` [PATCH 2/3] iommu/amd: move gart fallback to amd_iommu_init Kevin Mitchell
2019-06-12 21:52 ` [PATCH 3/3] iommu/amd: only free resources once on init error Kevin Mitchell
2019-07-01 11:54 ` [PATCH 0/3] handle init errors more gracefully in amd_iommu Joerg Roedel
-- strict thread matches above, loose matches on Subject: below --
2019-05-28 18:29 Kevin Mitchell
2019-05-28 18:29 ` [PATCH 1/3] iommu/amd: make iommu_disable safer Kevin Mitchell
2019-05-17 0:52 [PATCH 0/3] handle init errors more gracefully in amd_iommu Kevin Mitchell
2019-05-17 0:52 ` [PATCH 1/3] iommu/amd: make iommu_disable safer Kevin Mitchell
2019-05-27 13:50 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190612215203.12711-2-kevmitch@arista.com \
--to=kevmitch@arista.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).