lkml.org 
[lkml]   [2006]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    SubjectRe: [PATCH] proc: readdir race fix.
    Date
    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/

    \
     
     \ /
      Last update: 2006-09-05 04:59    [W:0.027 / U:30.136 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site