Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 04:17:09PM +, Robin Murphy wrote: > FWIW it looks like it *has* always been possible to hit this crash by > allocating a domain and freeing it again without attaching any devices, it's > just highly improbable for any sane code to do that explicitly, so the real > latent

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Robin Murphy
On 2018-11-07 4:03 pm, Joerg Roedel wrote: On Wed, Nov 07, 2018 at 04:50:40PM +0100, Geert Uytterhoeven wrote: It only got triggered by the combination of commits 6c2fb2ea76361da9 ("of/device: Set bus DMA mask as appropriate") and b4ebe6063204da58 ("dma-direct: implement complete bus_dma_mask ha

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 02:18:50PM +0100, Geert Uytterhoeven wrote: > Fix this by checking if the domain's context already exists, before > trying to destroy it. > > Signed-off-by: Geert Uytterhoeven > --- > drivers/iommu/ipmmu-vmsa.c | 3 +++ > 1 file changed, 3 insertions(+) Applied, thanks

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 04:50:40PM +0100, Geert Uytterhoeven wrote: > It only got triggered by the combination of commits 6c2fb2ea76361da9 > ("of/device: Set bus DMA mask as appropriate") and b4ebe6063204da58 > ("dma-direct: implement complete bus_dma_mask handling"), which is being > fixed by "of/

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Geert Uytterhoeven
Hi Jörg, On Wed, Nov 7, 2018 at 4:34 PM Joerg Roedel wrote: > On Wed, Nov 07, 2018 at 01:22:52PM +, Robin Murphy wrote: > > On 2018-11-07 1:18 pm, Geert Uytterhoeven wrote: > > > Fix this by checking if the domain's context already exists, before > > > trying to destroy it. > > > > Reviewed-b

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Joerg Roedel
On Wed, Nov 07, 2018 at 01:22:52PM +, Robin Murphy wrote: > On 2018-11-07 1:18 pm, Geert Uytterhoeven wrote: > > Fix this by checking if the domain's context already exists, before > > trying to destroy it. > > Reviewed-by: Robin Murphy Does this need a Fixes-tag? If so, which patch should b

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Robin Murphy
On 2018-11-07 1:18 pm, Geert Uytterhoeven wrote: If iommu_ops.add_device() fails, iommu_ops.domain_free() is still called, leading to a crash, as the domain was only partially initialized: ipmmu-vmsa e67b.mmu: Cannot accommodate DMA translation for IOMMU page tables sata_rcar ee30

[PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Geert Uytterhoeven
If iommu_ops.add_device() fails, iommu_ops.domain_free() is still called, leading to a crash, as the domain was only partially initialized: ipmmu-vmsa e67b.mmu: Cannot accommodate DMA translation for IOMMU page tables sata_rcar ee30.sata: Unable to initialize IPMMU context iom