[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180223222736.18542-2-bigeasy@linutronix.de>
Date: Fri, 23 Feb 2018 23:27:27 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: iommu@...ts.linux-foundation.org
Cc: linux-kernel@...r.kernel.org, Joerg Roedel <joro@...tes.org>,
tglx@...utronix.de,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Baoquan He <bhe@...hat.com>
Subject: [PATCH 01/10] iommu/amd: take into account that alloc_dev_data() may return NULL
find_dev_data() does not check whether the return value alloc_dev_data()
is NULL. This was okay once because the pointer was returned once as-is.
Since commit df3f7a6e8e85 ("iommu/amd: Use is_attach_deferred
call-back") the pointer may be used within find_dev_data() so a NULL
check is required.
Cc: Baoquan He <bhe@...hat.com>
Fixes: df3f7a6e8e85 ("iommu/amd: Use is_attach_deferred call-back")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
drivers/iommu/amd_iommu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 74788fdeb773..8b591c192daf 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -310,6 +310,8 @@ static struct iommu_dev_data *find_dev_data(u16 devid)
if (dev_data == NULL) {
dev_data = alloc_dev_data(devid);
+ if (!dev_data)
+ return NULL;
if (translation_pre_enabled(iommu))
dev_data->defer_attach = true;
--
2.16.1
Powered by blists - more mailing lists