aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-05-04 21:41:29 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-04 21:41:29 +0000
commit14f28842f97e26213c9c7a53a7348c5975d33cbc (patch)
tree1e634486615d455ca9957f7faf44eefb2c5d99da
parent577b182b36ff4e71f7d2ed3abba9500e32f5b061 (diff)
parent6a8aa6ba8bfec89ad16f964e42ac11d905ad7a1c (diff)
downloadedison-v3.10-14f28842f97e26213c9c7a53a7348c5975d33cbc.tar.gz
BACKPORT: seccomp: cap SECCOMP_RET_ERRNO data to MAX_ERRNO
am: 6a8aa6ba8b * commit '6a8aa6ba8bfec89ad16f964e42ac11d905ad7a1c': BACKPORT: seccomp: cap SECCOMP_RET_ERRNO data to MAX_ERRNO Change-Id: I3c85b24bf1413f16ca653366f400d24fdbfda878
-rw-r--r--kernel/seccomp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 1fbb1a2bc45..ba54fc2f417 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -600,7 +600,9 @@ int __secure_computing(int this_syscall)
ret &= SECCOMP_RET_ACTION;
switch (ret) {
case SECCOMP_RET_ERRNO:
- /* Set the low-order 16-bits as a errno. */
+ /* Set low-order bits as an errno, capped at MAX_ERRNO. */
+ if (data > MAX_ERRNO)
+ data = MAX_ERRNO;
syscall_set_return_value(current, regs,
-data, 0);
goto skip;