[PATCH] IPC: Initialize structure memory to zero forcompat_sys_mq_*

From: Dan Rosenberg
Date: Wed Oct 06 2010 - 21:01:42 EST


The "reserved" member should be zeroed before copying back to userspace
to avoid leaking uninitialized kernel stack memory.

Signed-off-by: Dan Rosenberg <drosenberg@xxxxxxxxxxxxx>

--- linux-2.6.35.5.orig/ipc/compat_mq.c 2010-09-20 16:59:09.000000000 -0400
+++ linux-2.6.35.5/ipc/compat_mq.c 2010-10-06 20:55:08.000000000 -0400
@@ -52,7 +52,7 @@ asmlinkage long compat_sys_mq_open(const
{
void __user *p = NULL;
if (u_attr && oflag & O_CREAT) {
- struct mq_attr attr;
+ struct mq_attr attr = {};
p = compat_alloc_user_space(sizeof(attr));
if (get_compat_mq_attr(&attr, u_attr) ||
copy_to_user(p, &attr, sizeof(attr)))
@@ -123,7 +123,7 @@ asmlinkage long compat_sys_mq_getsetattr
const struct compat_mq_attr __user *u_mqstat,
struct compat_mq_attr __user *u_omqstat)
{
- struct mq_attr mqstat;
+ struct mq_attr mqstat = {};
struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p));
long ret;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/