mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [merged] userfaultfd-non-cooperative-fix-fork-fctx-new-memleak.patch removed from -mm tree
@ 2017-03-10 21:43 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-03-10 21:43 UTC (permalink / raw)
  To: rppt, aarcange, dgilbert, hillf.zj, mike.kravetz, xemul, mm-commits


The patch titled
     Subject: userfaultfd: non-cooperative: fix fork fctx->new memleak
has been removed from the -mm tree.  Its filename was
     userfaultfd-non-cooperative-fix-fork-fctx-new-memleak.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: userfaultfd: non-cooperative: fix fork fctx->new memleak

We have a memleak in the ->new ctx if the uffd of the parent is closed
before the fork event is read, nothing frees the new context.

Link: http://lkml.kernel.org/r/20170302173738.18994-2-aarcange@redhat.com
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reported-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/userfaultfd.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff -puN fs/userfaultfd.c~userfaultfd-non-cooperative-fix-fork-fctx-new-memleak fs/userfaultfd.c
--- a/fs/userfaultfd.c~userfaultfd-non-cooperative-fix-fork-fctx-new-memleak
+++ a/fs/userfaultfd.c
@@ -549,6 +549,15 @@ static void userfaultfd_event_wait_compl
 		if (ACCESS_ONCE(ctx->released) ||
 		    fatal_signal_pending(current)) {
 			__remove_wait_queue(&ctx->event_wqh, &ewq->wq);
+			if (ewq->msg.event == UFFD_EVENT_FORK) {
+				struct userfaultfd_ctx *new;
+
+				new = (struct userfaultfd_ctx *)
+					(unsigned long)
+					ewq->msg.arg.reserved.reserved1;
+
+				userfaultfd_ctx_put(new);
+			}
 			break;
 		}
 
_

Patches currently in -mm which might be from rppt@linux.vnet.ibm.com are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-10 21:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 21:43 [merged] userfaultfd-non-cooperative-fix-fork-fctx-new-memleak.patch removed from -mm tree akpm

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).