lkml.org 
[lkml]   [2007]   [Aug]   [15]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateWed, 15 Aug 2007 16:56:37 +0800
FromFengguang Wu <>
Subject[PATCH] seqfile: fix uninitialized memory allocation in mounts_open()
proc_mounts.m.buf is not explicitly zeroed at allocation time, which
may later confuse the seqfile code and triggle an kfree(m->buf).

Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
--- linux.orig/fs/proc/base.c
+++ linux/fs/proc/base.c
@@ -380,7 +380,7 @@ static int mounts_open(struct inode *ino
 
 	if (ns) {
 		ret = -ENOMEM;
-		p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
+		p = kzalloc(sizeof(struct proc_mounts), GFP_KERNEL);
 		if (p) {
 			file->private_data = &p->m;
 			ret = seq_open(file, &mounts_op);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-15 10:59    [from the cache]
©2003-2008