On Wed, 2017-02-15 at 16:42 +0200, Andy Shevchenko wrote:
> By default CONFIG_INTEL_IOMMU_DEFAULT_ON is not set and thus
> dmar_disabled variable is set.
>
> Intel IOMMU driver based on above doesn't set intel_iommu_enabled
> variable.
>
> The commit b0119e870837 ("iommu: Introduce new 'struct iommu_device'")
> mistakenly assumes it never happens and tries to unregister not ever
> registered resources, which crashes the kernel at boot time:
>
> BUG: unable to handle kernel NULL pointer dereference at
> 0000000000000008
> IP: iommu_device_unregister+0x31/0x60
>
> Make unregister procedure conditional in free_iommu().
Joerg, it looks like bug is still present. Can we get the fix merged?
Or do you have better ideas?
>
> Fixes: b0119e870837 ("iommu: Introduce new 'struct iommu_device'")
> Cc: Joerg Roedel <[email protected]>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> drivers/iommu/dmar.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index d9c0decfc91a..36e3f430d265 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1108,8 +1108,10 @@ static int alloc_iommu(struct dmar_drhd_unit
> *drhd)
>
> static void free_iommu(struct intel_iommu *iommu)
> {
> - iommu_device_sysfs_remove(&iommu->iommu);
> - iommu_device_unregister(&iommu->iommu);
> + if (intel_iommu_enabled) {
> + iommu_device_unregister(&iommu->iommu);
> + iommu_device_sysfs_remove(&iommu->iommu);
> + }
>
> if (iommu->irq) {
> if (iommu->pr_irq) {
--
Andy Shevchenko <[email protected]>
Intel Finland Oy
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu