diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2023-04-16 12:31:58 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-04-16 12:31:58 -0700 |
commit | e492cd61b986590a45c674ede7dd1c4dbf94cf24 (patch) | |
tree | 37dc59ea66842b5b7e57f32aba6cbce5143c1282 /fs/userfaultfd.c | |
parent | d46031f40e0f7f7bf63914bb3f2e404ad3886ecd (diff) | |
parent | 2ff559f31a5d50c31a3f9d849f8af90dc36c7105 (diff) |
sync mm-stable with mm-hotfixes-stable to pick up depended-upon upstream changes
Diffstat (limited to 'fs/userfaultfd.c')
-rw-r--r-- | fs/userfaultfd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 8395605790f6..3b2a41c330e6 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1977,8 +1977,10 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, ret = -EFAULT; if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) goto out; - /* Ignore unsupported features (userspace built against newer kernel) */ - features = uffdio_api.features & UFFD_API_FEATURES; + features = uffdio_api.features; + ret = -EINVAL; + if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES)) + goto err_out; ret = -EPERM; if ((features & UFFD_FEATURE_EVENT_FORK) && !capable(CAP_SYS_PTRACE)) goto err_out; |