iommu: Check for iommu_ops == NULL in iommu_probe_device()
PATCH 1/1 iommu: Check for iommu_ops == NULL in iommu_probe_device()
From: Joerg Roedel <[email protected]>
This check needs to be there and got lost at some point during development. Add it again.
--- drivers/iommu/iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/iommu.c +5 -1
@@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu)int iommu_probe_device (struct device *dev) {const struct iommu_ops *ops = dev->bus->iommu_ops; +int ret = -EINVAL ;WARN_ON (dev->iommu_group); -return ops->add_device (dev); +if (ops) + ret = ops->add_device (dev); + +return ret; }void iommu_release_device (struct device *dev)
Signature · 1 line
2.13.7
A message that is not in the archive (sent off-list or not yet received): 20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org
Hi Joerg,
Quoted 6 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
This check needs to be there and got lost at some point during development. Add it again.
Fixes 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')
I experience a regression with those 2 patches. I have virtio-pci device protected by virtual smmuv3 and in that case I get err = -EPROBE_DEFER after pci_for_each_dma_alias() in of_iommu_configure(). When iommu_probe_device is called, ops = NULL so it returns -EINVAL and err is overwritten. So there is no deferred probing while it happened before.
Thanks
Eric
Quoted 28 lines
Reported-by Marek Szyprowski <[email protected]>Reported-by kernelci.org bot <[email protected]>Signed-off-by Joerg Roedel <[email protected]>--- drivers/iommu/iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/iommu/iommu.c +5
-1@@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu)int iommu_probe_device (struct device *dev) {const struct iommu_ops *ops = dev->bus->iommu_ops; +int ret = -EINVAL ;WARN_ON (dev->iommu_group); -return ops->add_device (dev); +if (ops) + ret = ops->add_device (dev); + +return ret; }void iommu_release_device (struct device *dev)
A message that is not in the archive (sent off-list or not yet received): e1a87036-d2df-c59b-a23d-9093ba02bacd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Quoted 8 lines · Auger Eric
Hi Joerg,
Quoted 5 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
This check needs to be there and got lost at some point during development. Add it again.
Quoted 6 lines
Quoted 1 line
Fixes 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')I experience a regression with those 2 patches. I have virtio-pci device protected by virtual smmuv3 and in that case I get err = -EPROBE_DEFER after
pci_for_each_dma_alias()inof_iommu_configure(). Wheniommu_probe_deviceis called, ops = NULL so it returns-EINVALand err is overwritten. So there is no deferred probing while it happened before.
There is a fix on the list:
https://www.spinics.net/lists/arm-kernel/msg698371.html
Thanks,
Jean
A message that is not in the archive (sent off-list or not yet received): 270d1c47-0752-68c7-e5ca-d19dcd170bbc-5wv7dgnIgG8@public.gmane.org
Quoted 2 lines · Jean-Philippe Brucker
There is a fix on the list:
https://www.spinics.net/lists/arm-kernel/msg698371.html
It is also in my tree already, I will send it upstream this week.
Regards,
Joerg
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Jean, Joerg,
Quoted 5 lines · Joerg Roedel
Quoted 2 lines · Jean-Philippe Brucker
There is a fix on the list:
https://www.spinics.net/lists/arm-kernel/msg698371.htmlIt is also in my tree already, I will send it upstream this week.
OK thanks!
Eric
Quoted 5 lines
Regards,
Joerg