From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alexey Dobriyan <adobriyan@openvz.org>
Subject: Re: [PATCH] Make /proc/net a symlink on /proc/self/net
Date: Wed, 5 Mar 2008 16:22:05 -0800 [thread overview]
Message-ID: <20080306002205.GI8728@linux.vnet.ibm.com> (raw)
In-Reply-To: <m1ablc3eo3.fsf@ebiederm.dsl.xmission.com>
On Wed, Mar 05, 2008 at 04:59:56PM -0700, Eric W. Biederman wrote:
> >>
> >> +static struct net *get_proc_task_net(struct inode *dir)
> >> +{
> >> + struct task_struct *task;
> >> + struct nsproxy *ns;
> >> + struct net *net = NULL;
> >> +
> >> + rcu_read_lock();
> >> + task = get_proc_task(dir);
> >
> > This implies a get_task_struct(), as get_proc_task() invokes get_proc_task()
> > which invokes get_pid_task() which invokes get_task_struct().
> >
> > I don't see the corresponding put_task_struct() -- what am I missing here?
>
> You aren't. However we can easily make this:
> task = pid_task(proc_pid(dir), PIDTYPE_PID);
> And we won't need to increment the count on the task_struct.
That looks like it should do the trick! And the net_get() below
will allow you to safely export the "net" pointer out of an RCU
read-side critical section, so with that change looks good to me!
Thanx, Paul
> Good catch.
>
> >> + if (task != NULL) {
> >> + ns = task_nsproxy(task);
> >> + if (ns != NULL)
> >> + net = get_net(ns->net_ns);
> >> + }
> >> + rcu_read_unlock();
> >> +
> >> + return net;
> >> +}
> >> +
next prev parent reply other threads:[~2008-03-06 0:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 12:20 [PATCH] Make /proc/net a symlink on /proc/self/net Pavel Emelyanov
2008-03-05 19:15 ` Paul E. McKenney
2008-03-05 21:29 ` David Miller
2008-03-05 23:59 ` Eric W. Biederman
2008-03-06 0:22 ` Paul E. McKenney [this message]
2008-03-06 8:25 ` Pavel Emelyanov
2008-03-06 0:24 ` Eric W. Biederman
2008-03-06 8:40 ` Pavel Emelyanov
2008-03-23 13:00 ` Denys Vlasenko
2008-03-23 13:04 ` Denys Vlasenko
2008-03-23 13:16 ` David Miller
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=20080306002205.GI8728@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=adobriyan@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xemul@openvz.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.