Skip to content

Commit 2062f9f

Browse files
Oleksandr Tyshchenkojgross1
authored andcommitted
xen/grant-dma-iommu: Implement a dummy probe_device() callback
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 57365a0 ("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 <[email protected]> Fixes: 57365a0 ("iommu: Move bus setup to IOMMU device registration") Signed-off-by: Oleksandr Tyshchenko <[email protected]> Tested-by: Viresh Kumar <[email protected]> Reviewed-by: Stefano Stabellini <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent c70b774 commit 2062f9f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/xen/grant-dma-iommu.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ struct grant_dma_iommu_device {
1616
struct iommu_device iommu;
1717
};
1818

19-
/* Nothing is really needed here */
20-
static const struct iommu_ops grant_dma_iommu_ops;
19+
static struct iommu_device *grant_dma_iommu_probe_device(struct device *dev)
20+
{
21+
return ERR_PTR(-ENODEV);
22+
}
23+
24+
/* Nothing is really needed here except a dummy probe_device callback */
25+
static const struct iommu_ops grant_dma_iommu_ops = {
26+
.probe_device = grant_dma_iommu_probe_device,
27+
};
2128

2229
static const struct of_device_id grant_dma_iommu_of_match[] = {
2330
{ .compatible = "xen,grant-dma" },

0 commit comments

Comments
 (0)