From: Bart Van Assche <bvanassche@acm.org>
To: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <chleroy@kernel.org>,
Ritesh Harjani <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>, Qian Cai <cai@lca.pw>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH] powerpc/iommu: Fix an RCU read lock leak in mm_iommu_is_devmem()
Date: Mon, 26 Oct 2026 12:52:50 -0700 [thread overview]
Message-ID: <56f0c45723ee53149a21ceb599010e957457afd8.1793044370.git.bvanassche@acm.org> (raw)
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;
}
}
next reply other threads:[~2026-10-26 19:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 19:52 Bart Van Assche [this message]
2026-10-26 20:27 ` Markus Elfring
2026-10-26 20:33 ` Bart Van Assche
2026-10-27 1:13 ` Ritesh Harjani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56f0c45723ee53149a21ceb599010e957457afd8.1793044370.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=cai@lca.pw \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®