|
@@ -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);
|