The sys_personality function is not meant to be called from other system
calls. We could introduce an intermediate ksys_personality function,
but it does almost nothing, so this just moves the implementation into
the caller.

Signed-off-by: Arnd Bergmann <[email protected]>
---
 arch/s390/kernel/sys_s390.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 31cefe0c28c0..560bdaf8a74f 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -79,12 +79,15 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned 
long, second,
 
 SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
 {
-       unsigned int ret;
+       unsigned int ret = current->personality;
 
        if (personality(current->personality) == PER_LINUX32 &&
            personality(personality) == PER_LINUX)
                personality |= PER_LINUX32;
-       ret = sys_personality(personality);
+
+       if (personality != 0xffffffff)
+               set_personality(personality);
+
        if (personality(ret) == PER_LINUX32)
                ret &= ~PER_LINUX32;
 
-- 
2.20.0

Reply via email to