]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/iommu: Don't detach device without IOMMU group
authorGavin Shan <shangw@linux.vnet.ibm.com>
Mon, 13 Jan 2014 03:36:22 +0000 (11:36 +0800)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 15 Jan 2014 02:58:33 +0000 (13:58 +1100)
commit4a3ee15524502707a5290e53047fe56c9a10fd82
tree89c8b8458ddc399f0e8faf0306227a1caa69cbe6
parente2fe26c24b0b6f8a2d2f7bbb3235154b6ea17339
powerpc/iommu: Don't detach device without IOMMU group

Some devices, for example PCI root port, don't have IOMMU table and
group. We needn't detach them from their IOMMU group. Otherwise, it
potentially incurs kernel crash because of referring NULL IOMMU group
as following backtrace indicates:

  .iommu_group_remove_device+0x74/0x1b0
  .iommu_bus_notifier+0x94/0xb4
  .notifier_call_chain+0x78/0xe8
  .__blocking_notifier_call_chain+0x7c/0xbc
  .blocking_notifier_call_chain+0x38/0x48
  .device_del+0x50/0x234
  .pci_remove_bus_device+0x88/0x138
  .pci_stop_and_remove_bus_device+0x2c/0x40
  .pcibios_remove_pci_devices+0xcc/0xfc
  .pcibios_remove_pci_devices+0x3c/0xfc

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/iommu.c