mm/mmu_notifier: fix mmget() assert in __mmu_interval_notifier_insert
authorJann Horn <jannh@google.com>
Fri, 16 Oct 2020 03:07:43 +0000 (20:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 16 Oct 2020 18:11:17 +0000 (11:11 -0700)
commitc9682d10271e1025ebfbb1675c7afffbef5c6856
tree6f203c4e411b658fdadeab493e4b51311bfa0d6d
parent295a17302348bc38704ef0f11ca2ce4ce58db2e9
mm/mmu_notifier: fix mmget() assert in __mmu_interval_notifier_insert

The comment talks about having to hold mmget() (which means mm_users), but
the actual check is on mm_count (which would be mmgrab()).

Given that MMU notifiers are torn down in mmput() -> __mmput() ->
exit_mmap() -> mmu_notifier_release(), I believe that the comment is
correct and the check should be on mm->mm_users.  Fix it up accordingly.

Fixes: 99cb252f5e68 ("mm/mmu_notifier: add an interval tree notifier")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Christian König <christian.koenig@amd.com
Link: https://lkml.kernel.org/r/20200901000143.207585-1-jannh@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmu_notifier.c