linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Jann Horn <jannh@google.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org, "John Hubbard" <jhubbard@nvidia.com>,
	"Christoph Hellwig" <hch@lst.de>,
	linux-kernel@vger.kernel.org,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] mm/mmu_notifier: Fix mmget() assert in __mmu_interval_notifier_insert
Date: Mon, 31 Aug 2020 21:26:34 -0300	[thread overview]
Message-ID: <20200901002634.GD24045@ziepe.ca> (raw)
In-Reply-To: <20200901000143.207585-1-jannh@google.com>

On Tue, Sep 01, 2020 at 02:01:43AM +0200, Jann Horn wrote:
> 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>
> ---
> Can someone please double-check this? I'm like 90% sure that I fixed
> this the right way around, but it'd be good if someone more familiar
> with mmu notifiers could confirm.

Hmm.. I added the comment but copied the expression from older code.

The intent is certainly that the caller must have a mmget, this
function must not race with __mmu_notifier_release() and the mmget is
what prevents that.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

      reply	other threads:[~2020-09-01  0:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01  0:01 [PATCH] mm/mmu_notifier: Fix mmget() assert in __mmu_interval_notifier_insert Jann Horn
2020-09-01  0:26 ` Jason Gunthorpe [this message]

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=20200901002634.GD24045@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=hch@lst.de \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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;
as well as URLs for NNTP newsgroup(s).