This is a note to let you know that I've just added the patch titled mm/mmu_notifier: fix mmget() assert in __mmu_interval_notifier_insert to the 5.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-mmu_notifier-fix-mmget-assert-in-__mmu_interval_n.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 66da55b8babcf5379e129595e69bcb13b6b268d5 Author: Jann Horn <jannh@xxxxxxxxxx> Date: Thu Oct 15 20:07:43 2020 -0700 mm/mmu_notifier: fix mmget() assert in __mmu_interval_notifier_insert [ Upstream commit c9682d10271e1025ebfbb1675c7afffbef5c6856 ] 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@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Christian König <christian.koenig@xxxxxxx Link: https://lkml.kernel.org/r/20200901000143.207585-1-jannh@xxxxxxxxxx Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 4fc918163dd32..5654dd19addc0 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -913,7 +913,7 @@ static int __mmu_interval_notifier_insert( return -EOVERFLOW; /* Must call with a mmget() held */ - if (WARN_ON(atomic_read(&mm->mm_count) <= 0)) + if (WARN_ON(atomic_read(&mm->mm_users) <= 0)) return -EINVAL; /* pairs with mmdrop in mmu_interval_notifier_remove() */