Merge branch 'v4.4/topic/hibernate' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / fs / userfaultfd.c
index f9aeb40a7197475ec52ba414852ff356129b0aab..66cdb44616d5a0ba79a04f60de5fd835805b6e56 100644 (file)
@@ -286,6 +286,12 @@ int handle_userfault(struct vm_area_struct *vma, unsigned long address,
        if (unlikely(ACCESS_ONCE(ctx->released)))
                goto out;
 
+       /*
+        * We don't do userfault handling for the final child pid update.
+        */
+       if (current->flags & PF_EXITING)
+               goto out;
+
        /*
         * Check that we can return VM_FAULT_RETRY.
         *
@@ -467,8 +473,8 @@ static int userfaultfd_release(struct inode *inode, struct file *file)
         * the fault_*wqh.
         */
        spin_lock(&ctx->fault_pending_wqh.lock);
-       __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, 0, &range);
-       __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, 0, &range);
+       __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range);
+       __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, &range);
        spin_unlock(&ctx->fault_pending_wqh.lock);
 
        wake_up_poll(&ctx->fd_wqh, POLLHUP);
@@ -650,10 +656,10 @@ static void __wake_userfault(struct userfaultfd_ctx *ctx,
        spin_lock(&ctx->fault_pending_wqh.lock);
        /* wake all in the range and autoremove */
        if (waitqueue_active(&ctx->fault_pending_wqh))
-               __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, 0,
+               __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL,
                                     range);
        if (waitqueue_active(&ctx->fault_wqh))
-               __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, 0, range);
+               __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, range);
        spin_unlock(&ctx->fault_pending_wqh.lock);
 }