Patch "mm/mmu_notifier: fix mmget() assert in __mmu_interval_notifier_insert" has been added to the 5.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.8-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.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fe5cb9c1da4800f1d8411f22cb03bf982e3f5e7b
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 352bb9f3ecc02..0d31b4ee63c04 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() */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux