From: ebiederm@xmission.com (Eric W. Biederman)
To: "Catalin Marinas" <catalin.marinas@gmail.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: Possible "struct pid" leak from tty_io.c
Date: Wed, 14 Mar 2007 08:40:43 -0600 [thread overview]
Message-ID: <m1wt1jq45w.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <b0943d9e0703140259p773b0eb8p9c142d33934e64ff@mail.gmail.com> (Catalin Marinas's message of "Wed, 14 Mar 2007 09:59:21 +0000")
How does this look?
I don't have the setup to test this easily, but this bit makes seems to make
sense. I will keep code reviewing and see if I can convince myself that this
is correct or incorrect in the mean time...
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e453268..fc125ac 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1376,6 +1376,8 @@ static void do_tty_hangup(struct work_struct *work)
read_unlock(&tasklist_lock);
tty->flags = 0;
+ put_pid(tty->session);
+ put_pid(tty->pgrp);
tty->session = NULL;
tty->pgrp = NULL;
tty->ctrl_status = 0;
@@ -3841,6 +3843,8 @@ static struct pid *__proc_set_tty(struct task_struct *tsk, struct tty_struct *tt
{
struct pid *old_pgrp;
if (tty) {
+ put_pid(tty->session);
+ put_pid(tty->pgrp);
tty->session = get_pid(task_session(tsk));
tty->pgrp = get_pid(task_pgrp(tsk));
}
next prev parent reply other threads:[~2007-03-14 14:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 17:27 Catalin Marinas
2007-03-08 18:11 ` Eric W. Biederman
2007-03-09 10:53 ` Catalin Marinas
2007-03-09 16:13 ` Eric W. Biederman
2007-03-09 16:53 ` Catalin Marinas
2007-03-09 16:44 ` Catalin Marinas
2007-03-09 17:09 ` Eric W. Biederman
2007-03-12 15:07 ` Catalin Marinas
2007-03-12 16:12 ` Eric W. Biederman
2007-03-13 19:31 ` Eric W. Biederman
2007-03-14 9:59 ` Catalin Marinas
2007-03-14 14:40 ` Eric W. Biederman [this message]
2007-03-14 17:08 ` Catalin Marinas
2007-03-15 19:15 ` Eric W. Biederman
2007-03-16 22:01 ` Eric W. Biederman
2007-03-16 22:44 ` Catalin Marinas
2007-03-18 18:45 ` [PATCH] tty: Fix two reported pid leaks Eric W. Biederman
2007-03-18 18:52 ` [PATCH 0/4] tty: small fixes and cleanups Eric W. Biederman
2007-03-18 18:57 ` [PATCH 1/4] tty: Remove unnecessary export of proc_clear_tty Eric W. Biederman
2007-03-18 19:03 ` [PATCH 2/4] tty: Simplify calling of put_pid Eric W. Biederman
2007-03-18 19:08 ` [PATCH 3/4] tty: Introduce no_tty and use it in selinux Eric W. Biederman
2007-03-18 19:13 ` [PATCH 4/4] tty: In tiocsctty when we steal a tty hang it up Eric W. Biederman
2007-03-18 20:55 ` [PATCH 3/4] tty: Introduce no_tty and use it in selinux Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1wt1jq45w.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=catalin.marinas@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®