iommu: Make sysfs robust for non-API groups
authorRobin Murphy <robin.murphy@arm.com>
Wed, 4 May 2022 12:39:58 +0000 (13:39 +0100)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 May 2022 13:13:39 +0000 (15:13 +0200)
commit392bf51946c2463436a1ba237c1ec5865b234825
tree39ebe565ec6b50fddc321f46bfae3a87e9feee9c
parent2ac2fab52917ae82cbca97cf6e5d2993530257ed
iommu: Make sysfs robust for non-API groups

Groups created by VFIO backends outside the core IOMMU API should never
be passed directly into the API itself, however they still expose their
standard sysfs attributes, so we can still stumble across them that way.
Take care to consider those cases before jumping into our normal
assumptions of a fully-initialised core API group.

Fixes: 3f6634d997db ("iommu: Use right way to retrieve iommu_ops")
Reported-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/86ada41986988511a8424e84746dfe9ba7f87573.1651667683.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c