Skip to content

Commit 5301c06

Browse files
ldv-altsashalevin
authored andcommitted
sparc64: fix incorrect sign extension in sys_sparc64_personality
[ Upstream commit 525fd5a ] The value returned by sys_personality has type "long int". It is saved to a variable of type "int", which is not a problem yet because the type of task_struct->pesonality is "unsigned int". The problem is the sign extension from "int" to "long int" that happens on return from sys_sparc64_personality. For example, a userspace call personality((unsigned) -EINVAL) will result to any subsequent personality call, including absolutely harmless read-only personality(0xffffffff) call, failing with errno set to EINVAL. Signed-off-by: Dmitry V. Levin <[email protected]> Cc: <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 2a048a2 commit 5301c06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/sparc/kernel/sys_sparc_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
413413

414414
SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
415415
{
416-
int ret;
416+
long ret;
417417

418418
if (personality(current->personality) == PER_LINUX32 &&
419419
personality(personality) == PER_LINUX)

0 commit comments

Comments
 (0)