mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] powerpc/iommu: Fix an RCU read lock leak in mm_iommu_is_devmem()
@ 2026-10-26 19:52 Bart Van Assche
  2026-10-26 20:27 ` Markus Elfring
  2026-10-27  1:13 ` Ritesh Harjani
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Van Assche @ 2026-10-26 19:52 UTC (permalink / raw)
  To: Madhavan Srinivasan
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Ritesh Harjani, Shrikanth Hegde, Qian Cai, linuxppc-dev,
	linux-kernel, Bart Van Assche

mm_iommu_is_devmem() returns true from inside its RCU read-side
critical section without calling rcu_read_unlock(). Neither caller,
iommu_tce_xchg_no_kill() nor tce_page_is_contained(), drops the RCU
read lock, so every successful lookup leaks one RCU read lock. Fix this
by calling rcu_read_unlock() before returning true. The pointer to the
list element is not used after the RCU read lock is dropped.

Fixes: b5952f8125ae ("powerpc/mm/book3s64/iommu: fix some RCU-list locks")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 arch/powerpc/mm/book3s64/iommu_api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/mm/book3s64/iommu_api.c b/arch/powerpc/mm/book3s64/iommu_api.c
index 60d00c9e7f19..e1e43573e8a8 100644
--- a/arch/powerpc/mm/book3s64/iommu_api.c
+++ b/arch/powerpc/mm/book3s64/iommu_api.c
@@ -371,6 +371,7 @@ bool mm_iommu_is_devmem(struct mm_struct *mm, unsigned long hpa,
 			 * and the caller needs to distinguish this situation.
 			 */
 			*size = min(1UL << pageshift, end - hpa);
+			rcu_read_unlock();
 			return true;
 		}
 	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-27  1:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 19:52 [PATCH] powerpc/iommu: Fix an RCU read lock leak in mm_iommu_is_devmem() Bart Van Assche
2026-10-26 20:27 ` Markus Elfring
2026-10-26 20:33   ` Bart Van Assche
2026-10-27  1:13 ` Ritesh Harjani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®