Messages in this thread Patch in this message | | | From | (Eric W. Biederman) | Subject | Re: [PATCH] proc: readdir race fix. | Date | Mon, 04 Sep 2006 20:54:30 -0600 |
| |
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:
> On Mon, 04 Sep 2006 17:13:10 -0600 > ebiederm@xmission.com (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.
Good catch. I actually have a pending cleanup that works better if the task struct is held across the filldir so the incremental patch should look like:
I also noticed a benign typo in TGID_OFFSET (1 subtract one that I shouldn't)
Complete patch in just a moment.
Eric
diff --git a/fs/proc/base.c b/fs/proc/base.c index b7650b9..03f6680 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2186,7 +2186,7 @@ int proc_pid_readdir(struct file * filp, tgid = filp->f_pos - TGID_OFFSET; for (task = next_tgid(tgid); task; - task = next_tgid(tgid + 1)) { + put_task_struct(task), task = next_tgid(tgid + 1)) { int len; ino_t ino; tgid = task->pid; - 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/
| |