To avoid accidental removal of an active IOMMU driver module, take a reference to the driver module in 'iommu_probe_device()' immediately prior to invoking the '->add_device()' callback and hold it until the after the device has been removed by '->remove_device()'.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -246,9 +246,10 @@ struct iommu_iotlb_gather { · 245 unmodified lines | |||
| 246 | * @sva_get_pasid: Get PASID associated to a SVA handle | 246 | * @sva_get_pasid: Get PASID associated to a SVA handle |
| 247 | * @page_response: handle page request response | 247 | * @page_response: handle page request response |
| 248 | * @cache_invalidate: invalidate translation caches | 248 | * @cache_invalidate: invalidate translation caches |
| 249 | * @pgsize_bitmap: bitmap of all possible supported page sizes | ||
| 250 | * @sva_bind_gpasid: bind guest pasid and mm | 249 | * @sva_bind_gpasid: bind guest pasid and mm |
| 251 | * @sva_unbind_gpasid: unbind guest pasid and mm | 250 | * @sva_unbind_gpasid: unbind guest pasid and mm |
| 251 | * @pgsize_bitmap: bitmap of all possible supported page sizes | ||
| 252 | * @owner: Driver module providing these ops | ||
| 252 | */ | 253 | */ |
| 253 | struct iommu_ops { | 254 | struct iommu_ops { |
| 254 | bool (*capable)(enum iommu_cap); | 255 | bool (*capable)(enum iommu_cap); |
| @@ -318,6 +319,7 @@ struct iommu_ops { · 63 unmodified lines | |||
| 318 | int (*sva_unbind_gpasid)(struct device *dev, int pasid); | 319 | int (*sva_unbind_gpasid)(struct device *dev, int pasid); |
| 319 | 320 | ||
| 320 | unsigned long pgsize_bitmap; | 321 | unsigned long pgsize_bitmap; |
| 322 | struct module *owner; | ||
| 321 | }; | 323 | }; |
| 322 | 324 | ||
| 323 | /** | 325 | /** |