Re: [PATCH v3] iommu: Check dev->iommu in iommu_dev_xxx functions

From: Joerg Roedel
Date: Thu Mar 18 2021 - 05:49:36 EST


On Wed, Mar 03, 2021 at 05:36:11PM +0000, Shameer Kolothum wrote:
> 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@xxxxxxxxxx>
> ---
> v2 --> v3
> -Removed iommu_ops from struct dev_iommu.
> v1 --> v2:
> -Added iommu_ops to struct dev_iommu based on the discussion with Robin.
> -Rebased against iommu-tree core branch.
> ---
> drivers/iommu/iommu.c | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)

Applied, thanks.