Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxx> writes:<snip>
The function spapr_tce_platform_iommu_attach_dev() is missing to call
iommu_group_put() when the domain is already set. This refcount leak
shows up with BUG_ON() during DLPAR remove operation as,
[c0000013aed5fd10] [c0000000005bfeb4] vfs_write+0xf8/0x488Sorry I already applied v1.
[c0000013aed5fdc0] [c0000000005c0570] ksys_write+0x84/0x140
[c0000013aed5fe10] [c000000000033358] system_call_exception+0x138/0x330
[c0000013aed5fe50] [c00000000000d05c] system_call_vectored_common+0x15c/0x2ec
--- interrupt: 3000 at 0x20000433acb4
<snip>
---[ end trace 0000000000000000 ]---
The patch makes the iommu_group_get() call only when using it there by
avoiding the leak.
Fixes: a8ca9fc9134c ("powerpc/iommu: Do not do platform domain attach atctions after probe")
Reported-by: Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/274e0d2b-b5cc-475e-94e6-8427e88e271d@xxxxxxxxxxxxxxxxxx
Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxx>
---
Changelog:
v1: https://lore.kernel.org/all/170784021983.6249.10039296655906636112.stgit@xxxxxxxxxxxxx/
- Minor refactor to call the iommu_group_get() only if required.
- Updated the title, description and signature(Closes/Reported-by).
If you send this as a patch on top of v1 with a new change log I can
merge it as a cleanup/rework.
cheers