aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Syromiatnikov2018-01-15 13:38:17 -0600
committerGreg Kroah-Hartman2018-02-22 08:44:58 -0600
commita76abe444968922e8c3743c1c575f7791c0cd8f8 (patch)
treef81da2acc27cb9301737186f227e88118e5552b8
parent8bb3fe364f8a77a2cc231e5861fc6b0322651df0 (diff)
downloadkernel-omap-a76abe444968922e8c3743c1c575f7791c0cd8f8.tar.gz
kernel-omap-a76abe444968922e8c3743c1c575f7791c0cd8f8.tar.xz
kernel-omap-a76abe444968922e8c3743c1c575f7791c0cd8f8.zip
s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
commit 6dd0d2d22aa363fec075cb2577ba273ac8462e94 upstream. For some reason, the implementation of some 16-bit ID system calls (namely, setuid16/setgid16 and setfsuid16/setfsgid16) used type cast instead of low2highgid/low2highuid macros for converting [GU]IDs, which led to incorrect handling of value of -1 (which ought to be considered invalid). Discovered by strace test suite. Cc: stable@vger.kernel.org Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/s390/kernel/compat_linux.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 0176ebc97bfd..86f934255eb6 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -110,7 +110,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid)
110 110
111COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid) 111COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid)
112{ 112{
113 return sys_setgid((gid_t)gid); 113 return sys_setgid(low2highgid(gid));
114} 114}
115 115
116COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid) 116COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid)
@@ -120,7 +120,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid)
120 120
121COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid) 121COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid)
122{ 122{
123 return sys_setuid((uid_t)uid); 123 return sys_setuid(low2highuid(uid));
124} 124}
125 125
126COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid) 126COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid)
@@ -173,12 +173,12 @@ COMPAT_SYSCALL_DEFINE3(s390_getresgid16, u16 __user *, rgidp,
173 173
174COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid) 174COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid)
175{ 175{
176 return sys_setfsuid((uid_t)uid); 176 return sys_setfsuid(low2highuid(uid));
177} 177}
178 178
179COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid) 179COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid)
180{ 180{
181 return sys_setfsgid((gid_t)gid); 181 return sys_setfsgid(low2highgid(gid));
182} 182}
183 183
184static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info) 184static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)