On 11/6/2026 Fri 12:35, Lizhi Hou wrote:
amdxdna_hmm_register() keys the umap list lookup and the interval
notifier insertion on current->mm, while amdxdna_hmm_unregister() and
amdxdna_mark_mapp_invalid() match the same list entries against
vma->vm_mm. The two are identical for the ->mmap() callback, so this is
not a functional change, but the inconsistency makes the code harder to
follow.

Use vma->vm_mm in both places. It is the mm whose mmap_lock is held
across ->mmap(), which is what mmu_interval_notifier_insert_locked()
asserts on, and it is the mm the teardown paths look the mapping up by.

Assisted-by: LLM
Signed-off-by: Lizhi Hou <[email protected]>
Reviewed-by: Max Zhen <[email protected]>
---
  drivers/accel/amdxdna/amdxdna_gem.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/amdxdna/amdxdna_gem.c 
b/drivers/accel/amdxdna/amdxdna_gem.c
index 09e48c794e1b..92125bc753c7 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -443,7 +443,7 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
down_read(&xdna->notifier_lock);
        list_for_each_entry(mapp, &abo->mem.umap_list, node) {
-               if (compare_range(mapp, current->mm, addr, addr + len)) {
+               if (compare_range(mapp, vma->vm_mm, addr, addr + len)) {
                        up_read(&xdna->notifier_lock);
                        return 0;
                }
@@ -477,7 +477,7 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
        kref_init(&mapp->refcnt);
ret = mmu_interval_notifier_insert_locked(&mapp->notifier,
-                                                 current->mm,
+                                                 vma->vm_mm,
                                                  addr,
                                                  len,
                                                  &amdxdna_hmm_ops);

base-commit: d2a8cee91bfa8616f713c7c8f539a81e8e3554ea

Reply via email to