linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Mark Hairgrove <mhairgrove@nvidia.com>, <linuxppc-dev@lists.ozlabs.org>
Cc: Alistair Popple <alistair@popple.id.au>,
	Mark Hairgrove <mhairgrove@nvidia.com>
Subject: Re: powerpc/npu-dma.c: Fix crash after __mmu_notifier_register failure
Date: Tue, 20 Mar 2018 09:22:47 +1100 (AEDT)	[thread overview]
Message-ID: <404rD852wzz9sVw@ozlabs.org> (raw)
In-Reply-To: <1518232806-17661-1-git-send-email-mhairgrove@nvidia.com>

On Sat, 2018-02-10 at 03:20:06 UTC, Mark Hairgrove wrote:
> pnv_npu2_init_context wasn't checking the return code from
> __mmu_notifier_register. If  __mmu_notifier_register failed, the
> npu_context was still assigned to the mm and the caller wasn't given any
> indication that things went wrong. Later on pnv_npu2_destroy_context would
> be called, which in turn called mmu_notifier_unregister and dropped
> mm->mm_count without having incremented it in the first place. This led to
> various forms of corruption like mm use-after-free and mm double-free.
> 
> __mmu_notifier_register can fail with EINTR if a signal is pending, so
> this case can be frequent.
> 
> This patch calls opal_npu_destroy_context on the failure paths, and makes
> sure not to assign mm->context.npu_context until past the failure points.
> 
> Signed-off-by: Mark Hairgrove <mhairgrove@nvidia.com>
> Acked-By: Alistair Popple <alistair@popple.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/720c84046c26444fe825f8614ddceb

cheers

      parent reply	other threads:[~2018-03-19 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10  3:20 [PATCH] powerpc/npu-dma.c: Fix crash after __mmu_notifier_register failure Mark Hairgrove
2018-02-13  4:07 ` Alistair Popple
2018-03-19 22:22 ` Michael Ellerman [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=404rD852wzz9sVw@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=alistair@popple.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhairgrove@nvidia.com \
    /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).