RE: [PATCH 1/3] iommu: Provide iommu_probe_device_locked()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Wednesday, August 9, 2023 1:27 AM
> 
> The two callers coming from bus_tye -> dma_configure() already have the

s/bus_tye/bus_type/

> device_lock held for the device being probed. Mark this in the API so that
> the core code doesn't attempt to re-acquire the same lock and deadlock.
> 
>   __iommu_probe_device from iommu_probe_device+0x10/0x40
>   iommu_probe_device from of_iommu_configure+0xf8/0x1c8
>   of_iommu_configure from of_dma_configure_id+0x188/0x450
>   of_dma_configure_id from platform_dma_configure+0x24/0x60
>   platform_dma_configure from really_probe+0xac/0x3d4
>   really_probe from __driver_probe_device+0xa0/0x1e8
>   __driver_probe_device from driver_probe_device+0x30/0xd0
>   driver_probe_device from __driver_attach+0x10c/0x190
>   __driver_attach from bus_for_each_dev+0x60/0xb4
>   bus_for_each_dev from bus_add_driver+0xe0/0x208
>   bus_add_driver from driver_register+0x7c/0x118
>   driver_register from exynos_drm_init+0xe0/0x14c
>   exynos_drm_init from do_one_initcall+0x6c/0x318
>   do_one_initcall from kernel_init_freeable+0x1c4/0x214
>   kernel_init_freeable from kernel_init+0x18/0x12c
>   kernel_init from ret_from_fork+0x14/0x2c
> 
> Internally make __iommu_probe_device() require the caller to get the
> device_lock().
> 
> The three remaining callers of iommu_probe_device() don't seem to hold the
> device_lock():
> 
>  powerpc/kernel/iommu.c: iommu_add_device()
>  iommu/iommu.c: iommu_bus_notifier()/BUS_NOTIFY_ADD_DEVICE/
>  intel/iommu.c: probe_acpi_namespace_devices()
> 
> Fixes: a2dde836050f ("iommu: Complete the locking for dev->iommu_group")
> Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> Closes: https://lore.kernel.org/linux-iommu/bc5d6aa8-e8ca-c896-2f39-
> af074d55e436@xxxxxxxxxxx
> Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux