Re: [PATCH] proc: readdir race fix.

From: KAMEZAWA Hiroyuki
Date: Mon Sep 04 2006 - 22:20:11 EST


On Mon, 04 Sep 2006 17:13:10 -0600
ebiederm@xxxxxxxxxxxx (Eric W. Biederman) wrote:
Hi, Hit OOM-Killer, because of memory leak of task struct.

patch is attached.
-Kame

task struct should be put always.

fs/proc/base.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.18-psfix/fs/proc/base.c
===================================================================
--- linux-2.6.18-psfix.orig/fs/proc/base.c 2006-09-05 10:42:40.000000000 +0900
+++ linux-2.6.18-psfix/fs/proc/base.c 2006-09-05 11:11:42.000000000 +0900
@@ -2193,8 +2193,8 @@
filp->f_pos = tgid + TGID_OFFSET;
len = snprintf(buf, sizeof(buf), "%d", tgid);
ino = fake_ino(tgid, PROC_TGID_INO);
+ put_task_struct(task);
if (filldir(dirent, buf, len, filp->f_pos, ino, DT_DIR) < 0) {
- put_task_struct(task);
goto out;
}
}

-
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/