Skip to content

Commit 58aff0a

Browse files
wildea01Al Viro
authored andcommitted
ipc/shm: Fix order of parameters when calling copy_compat_shmid_to_user
Commit 553f770 ("ipc: move compat shmctl to native") moved the compat IPC syscall handling into ipc/shm.c and refactored the struct accessors in the process. Unfortunately, the call to copy_compat_shmid_to_user when handling a compat {IPC,SHM}_STAT command gets the arguments the wrong way round, passing a kernel stack address as the user buffer (destination) and the user buffer as the kernel stack address (source). This patch fixes the parameter ordering so the buffers are accessed correctly. Cc: Al Viro <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent a90bcb8 commit 58aff0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ipc/shm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr)
12371237
err = shmctl_stat(ns, shmid, cmd, &sem64);
12381238
if (err < 0)
12391239
return err;
1240-
if (copy_compat_shmid_to_user(&sem64, uptr, version))
1240+
if (copy_compat_shmid_to_user(uptr, &sem64, version))
12411241
err = -EFAULT;
12421242
return err;
12431243

0 commit comments

Comments
 (0)