On Fri, May 15, 2020 at 09:51:03PM +0800, Lu Baolu wrote: > On 2020/5/15 17:45, Joerg Roedel wrote: > > struct iommu_domain *iommu_get_dma_domain(struct device *dev) > > { > > - return dev->iommu_group->default_domain; > > + struct iommu_domain *domain = dev->iommu_group->default_domain; > > + > > + if (__iommu_is_attach_deferred(domain, dev)) > > + __iommu_attach_device_no_defer(domain, dev); > > It seems that the return value needs to be checked. The default domain > is invalid if attach() failed.
True, I looked at that, the callers can't handle returning NULL here, so I kept it this way for now. The outcome is that DMA will fail, but otherwise we'd see a NULL-ptr dereference really quickly after returning from that function. Bottom line: This needs to be cleaned up separatly. Regards, Joerg