diff options
author | Eugene Syromiatnikov <esyr@redhat.com> | 2018-01-15 14:38:17 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2018-01-23 01:36:54 -0500 |
commit | 6dd0d2d22aa363fec075cb2577ba273ac8462e94 (patch) | |
tree | 0fd63b313c0874957d24686d230af62aa20ca8a3 | |
parent | 7fbf8315fb7fc7321919e6c880d70077aded515e (diff) |
s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
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>
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index f04db3779b34..9ba2ab2f8a94 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 | ||
111 | COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid) | 111 | COMPAT_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 | ||
116 | COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid) | 116 | COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid) |
@@ -120,7 +120,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid) | |||
120 | 120 | ||
121 | COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid) | 121 | COMPAT_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 | ||
126 | COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid) | 126 | COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid) |
@@ -173,12 +173,12 @@ COMPAT_SYSCALL_DEFINE3(s390_getresgid16, u16 __user *, rgidp, | |||
173 | 173 | ||
174 | COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid) | 174 | COMPAT_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 | ||
179 | COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid) | 179 | COMPAT_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 | ||
184 | static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info) | 184 | static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info) |