summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2018-02-22 10:50:24 -0800
committerJames Morris <jmorris@namei.org>2018-02-22 10:50:24 -0800
commit645ae5c51e85d7dbb25177866d5016a89d5243ad (patch)
treea4d638616c5db0bde980c6bf5b494f70b6bbef0c /kernel
parentaf3e79d29555b97dd096e2f8e36a0f50213808a8 (diff)
parentd057dc4e35e16050befa3dda943876dab39cbf80 (diff)
downloadlinux-645ae5c51e85d7dbb25177866d5016a89d5243ad.tar.gz
linux-645ae5c51e85d7dbb25177866d5016a89d5243ad.tar.bz2
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')
-rw-r--r--kernel/seccomp.c6
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;