aboutsummaryrefslogtreecommitdiff
path: root/ipc/compat_mq.c
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2010-10-27 15:34:17 -0700
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-04-17 16:15:41 -0400
commit5819449cad881107f3fd52025b7a0f5134ab1c85 (patch)
treece0e4ad55bec7b92cf1eb0512435c7162c1f02a7 /ipc/compat_mq.c
parent546b259bef0d2618f2a466a1a7e5678f245f3024 (diff)
ipc: initialize structure memory to zero for compat functions
commit 03145beb455cf5c20a761e8451e30b8a74ba58d9 upstream. 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 <drosenberg@vsecurity.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'ipc/compat_mq.c')
-rw-r--r--ipc/compat_mq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
index d8d1e9ff4e8..380ea4fe08e 100644
--- a/ipc/compat_mq.c
+++ b/ipc/compat_mq.c
@@ -53,6 +53,9 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name,
void __user *p = NULL;
if (u_attr && oflag & O_CREAT) {
struct mq_attr attr;
+
+ memset(&attr, 0, sizeof(attr));
+
p = compat_alloc_user_space(sizeof(attr));
if (get_compat_mq_attr(&attr, u_attr) ||
copy_to_user(p, &attr, sizeof(attr)))
@@ -127,6 +130,8 @@ asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p));
long ret;
+ memset(&mqstat, 0, sizeof(mqstat));
+
if (u_mqstat) {
if (get_compat_mq_attr(&mqstat, u_mqstat) ||
copy_to_user(p, &mqstat, sizeof(mqstat)))