diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2023-04-16 21:31:58 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-04-16 21:31:58 +0200 |
commit | e492cd61b986590a45c674ede7dd1c4dbf94cf24 (patch) | |
tree | 37dc59ea66842b5b7e57f32aba6cbce5143c1282 /fs/userfaultfd.c | |
parent | sched/numa: use hash_32 to mix up PIDs accessing VMA (diff) | |
parent | Revert "userfaultfd: don't fail on unrecognized features" (diff) | |
download | linux-e492cd61b986590a45c674ede7dd1c4dbf94cf24.tar.xz linux-e492cd61b986590a45c674ede7dd1c4dbf94cf24.zip |
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; |