[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200515142047.GX18353@8bytes.org>
Date: Fri, 15 May 2020 16:20:48 +0200
From: Joerg Roedel <joro@...tes.org>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: iommu@...ts.linux-foundation.org, jroedel@...e.de,
linux-kernel@...r.kernel.org, Tom Murphy <murphyt7@....ie>
Subject: Re: [PATCH] iommu: Implement deferred domain attachment
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
Powered by blists - more mailing lists