diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/userfaultfd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 5f11678907d5..af88ef6fffff 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -577,7 +577,6 @@ static ssize_t userfaultfd_read(struct file *file, char __user *buf, if (ctx->state == UFFD_STATE_WAIT_API) return -EINVAL; - BUG_ON(ctx->state != UFFD_STATE_RUNNING); for (;;) { if (count < sizeof(msg)) @@ -1115,6 +1114,9 @@ static long userfaultfd_ioctl(struct file *file, unsigned cmd, int ret = -EINVAL; struct userfaultfd_ctx *ctx = file->private_data; + if (cmd != UFFDIO_API && ctx->state == UFFD_STATE_WAIT_API) + return -EINVAL; + switch(cmd) { case UFFDIO_API: ret = userfaultfd_api(ctx, arg); |