|
@@ -530,8 +530,13 @@ out:
|
|
|
static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
|
|
|
struct userfaultfd_wait_queue *ewq)
|
|
|
{
|
|
|
- int ret = 0;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = -1;
|
|
|
+ if (WARN_ON_ONCE(current->flags & PF_EXITING))
|
|
|
+ goto out;
|
|
|
|
|
|
+ ret = 0;
|
|
|
ewq->ctx = ctx;
|
|
|
init_waitqueue_entry(&ewq->wq, current);
|
|
|
|
|
@@ -566,7 +571,7 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
|
|
|
* ctx may go away after this if the userfault pseudo fd is
|
|
|
* already released.
|
|
|
*/
|
|
|
-
|
|
|
+out:
|
|
|
userfaultfd_ctx_put(ctx);
|
|
|
return ret;
|
|
|
}
|