iommu: Check dev->iommu in iommu_dev_xxx functions
authorShameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Wed, 3 Mar 2021 17:36:11 +0000 (17:36 +0000)
committerJoerg Roedel <jroedel@suse.de>
Thu, 18 Mar 2021 09:48:10 +0000 (10:48 +0100)
commitb9abb19fa5fd2d8a4be61c6cd4b2a48aa1a17f9c
tree5b952707b8b623121a2ffe86d65b2d89b80d0240
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0
iommu: Check dev->iommu in iommu_dev_xxx functions

The device iommu probe/attach might have failed leaving dev->iommu
to NULL and device drivers may still invoke these functions resulting
in a crash in iommu vendor driver code.

Hence make sure we check that.

Fixes: a3a195929d40 ("iommu: Add APIs for multiple domains per device")
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20210303173611.520-1-shameerali.kolothum.thodi@huawei.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c