diff options
author | James Morris <jmorris@namei.org> | 2018-02-22 19:50:24 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2018-02-22 19:50:24 +0100 |
commit | 645ae5c51e85d7dbb25177866d5016a89d5243ad (patch) | |
tree | a4d638616c5db0bde980c6bf5b494f70b6bbef0c /kernel/seccomp.c | |
parent | Merge tag 'leds_for-4.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
parent | seccomp: add a selftest for get_metadata (diff) | |
download | linux-645ae5c51e85d7dbb25177866d5016a89d5243ad.tar.xz linux-645ae5c51e85d7dbb25177866d5016a89d5243ad.zip |
Merge tag 'seccomp-v4.16-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into fixes-v4.16-rc3
- Fix seccomp GET_METADATA to deal with field sizes correctly (Tycho Andersen)
- Add selftest to make sure GET_METADATA doesn't regress (Tycho Andersen)
Diffstat (limited to 'kernel/seccomp.c')
-rw-r--r-- | kernel/seccomp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 940fa408a288..dc77548167ef 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -1076,14 +1076,16 @@ long seccomp_get_metadata(struct task_struct *task, size = min_t(unsigned long, size, sizeof(kmd)); - if (copy_from_user(&kmd, data, size)) + if (size < sizeof(kmd.filter_off)) + return -EINVAL; + + if (copy_from_user(&kmd.filter_off, data, sizeof(kmd.filter_off))) return -EFAULT; filter = get_nth_filter(task, kmd.filter_off); if (IS_ERR(filter)) return PTR_ERR(filter); - memset(&kmd, 0, sizeof(kmd)); if (filter->log) kmd.flags |= SECCOMP_FILTER_FLAG_LOG; |