summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>2023-02-08 17:36:49 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-10 09:33:02 +0100
commitcd9dff330e8932653b13a15abc278c46ca73fe6f (patch)
tree5a6432063a8dadd916929682540d4055f0bb45aa
parentfbbe6ddb6062ebd507152099ce18528f91df5887 (diff)
downloadlinux-stable-cd9dff330e8932653b13a15abc278c46ca73fe6f.tar.gz
linux-stable-cd9dff330e8932653b13a15abc278c46ca73fe6f.tar.bz2
linux-stable-cd9dff330e8932653b13a15abc278c46ca73fe6f.zip
xen/grant-dma-iommu: Implement a dummy probe_device() callback
[ Upstream commit 2062f9fb6445451b189595e295765c69f43bc12e ] Update stub IOMMU driver (which main purpose is to reuse generic IOMMU device-tree bindings by Xen grant DMA-mapping layer on Arm) according to the recent changes done in the following commit 57365a04c921 ("iommu: Move bus setup to IOMMU device registration"). With probe_device() callback being called during IOMMU device registration, the uninitialized callback just leads to the "kernel NULL pointer dereference" issue during boot. Fix that by adding a dummy callback. Looks like the release_device() callback is not mandatory to be implemented as IOMMU framework makes sure that callback is initialized before dereferencing. Reported-by: Viresh Kumar <viresh.kumar@linaro.org> Fixes: 57365a04c921 ("iommu: Move bus setup to IOMMU device registration") Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Tested-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Link: https://lore.kernel.org/r/20230208153649.3604857-1-olekstysh@gmail.com Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/xen/grant-dma-iommu.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/xen/grant-dma-iommu.c b/drivers/xen/grant-dma-iommu.c
index 16b8bc0c0b33..6a9fe02c6bfc 100644
--- a/drivers/xen/grant-dma-iommu.c
+++ b/drivers/xen/grant-dma-iommu.c
@@ -16,8 +16,15 @@ struct grant_dma_iommu_device {
struct iommu_device iommu;
};
-/* Nothing is really needed here */
-static const struct iommu_ops grant_dma_iommu_ops;
+static struct iommu_device *grant_dma_iommu_probe_device(struct device *dev)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+/* Nothing is really needed here except a dummy probe_device callback */
+static const struct iommu_ops grant_dma_iommu_ops = {
+ .probe_device = grant_dma_iommu_probe_device,
+};
static const struct of_device_id grant_dma_iommu_of_match[] = {
{ .compatible = "xen,grant-dma" },