Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734298

[PATCH] ipc/shm: Fix order of parameters when calling copy_compat_shmid_to_user

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject [PATCH] ipc/shm: Fix order of parameters when calling copy_compat_shmid_to_user
Date 2017-09-18 18:50 +0200
Message-ID <ur7p8-ju-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Commit 553f770ef71b ("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 <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 ipc/shm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index 1b3adfe3c60e..1e2b1692ba2c 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1237,7 +1237,7 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, void __user *, uptr)
 		err = shmctl_stat(ns, shmid, cmd, &sem64);
 		if (err < 0)
 			return err;
-		if (copy_compat_shmid_to_user(&sem64, uptr, version))
+		if (copy_compat_shmid_to_user(uptr, &sem64, version))
 			err = -EFAULT;
 		return err;
 
-- 
2.1.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ipc/shm: Fix order of parameters when calling copy_compat_shmid_to_user Will Deacon <will.deacon@arm.com> - 2017-09-18 18:50 +0200
  Re: [PATCH] ipc/shm: Fix order of parameters when calling  copy_compat_shmid_to_user Will Deacon <will.deacon@arm.com> - 2017-09-20 11:50 +0200
  Re: [PATCH] ipc/shm: Fix order of parameters when calling  copy_compat_shmid_to_user Al Viro <viro@ZenIV.linux.org.uk> - 2017-09-20 13:10 +0200

csiph-web