[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b0943d9e0703140259p773b0eb8p9c142d33934e64ff@mail.gmail.com>
Date: Wed, 14 Mar 2007 09:59:21 +0000
From: "Catalin Marinas" <catalin.marinas@...il.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: Re: Possible "struct pid" leak from tty_io.c
On 13/03/07, Eric W. Biederman <ebiederm@...ssion.com> wrote:
> "Catalin Marinas" <catalin.marinas@...il.com> writes:
> > void proc_clear_tty(struct task_struct *p)
> > {
> > + struct tty_struct *tty;
> > +
> > spin_lock_irq(&p->sighand->siglock);
> > + tty = p->signal->tty;
> > + if (tty) {
> > + put_pid(tty->session);
> > + put_pid(tty->pgrp);
> > + }
> > p->signal->tty = NULL;
> > spin_unlock_irq(&p->sighand->siglock);
> > }
>
> This patch can't be right. Not the way proc_clear_tty is called
> once for each process in the session, plus we aren't clearing
> tty->session and tty->pgrp here.
>
> If the above patch works it's a fluke.
I looked at the logs and the pointer isn't freed indeed. It is just a
false negative in kmemleak and it would appear as a leak at some
point. But the previous patch (do_tty_hangup) seems to fix one of the
leaks.
For the 2nd leak, proc_set_tty is called and, for symmetry, I added
put_pid in proc_clear_tty (but without any deep thought). I also
haven't checked any lockdep issues with adding put_pid when
p->sighand->siglock is held.
--
Catalin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists