mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
ipc: initialize structure memory to zero for compat functions
This takes care of leaking uninitialized kernel stack memory to userspace from non-zeroed fields in structs in compat ipc functions. Signed-off-by: Dan Rosenberg <[email protected]> Cc: Manfred Spraul <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
b795218075
commit
03145beb45
2 changed files with 11 additions and 0 deletions
|
|
@ -241,6 +241,8 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr)
|
|||
struct semid64_ds __user *up64;
|
||||
int version = compat_ipc_parse_version(&third);
|
||||
|
||||
memset(&s64, 0, sizeof(s64));
|
||||
|
||||
if (!uptr)
|
||||
return -EINVAL;
|
||||
if (get_user(pad, (u32 __user *) uptr))
|
||||
|
|
@ -421,6 +423,8 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
|
|||
int version = compat_ipc_parse_version(&second);
|
||||
void __user *p;
|
||||
|
||||
memset(&m64, 0, sizeof(m64));
|
||||
|
||||
switch (second & (~IPC_64)) {
|
||||
case IPC_INFO:
|
||||
case IPC_RMID:
|
||||
|
|
@ -594,6 +598,8 @@ long compat_sys_shmctl(int first, int second, void __user *uptr)
|
|||
int err, err2;
|
||||
int version = compat_ipc_parse_version(&second);
|
||||
|
||||
memset(&s64, 0, sizeof(s64));
|
||||
|
||||
switch (second & (~IPC_64)) {
|
||||
case IPC_RMID:
|
||||
case SHM_LOCK:
|
||||
|
|
|
|||
Loading…
Reference in a new issue