Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760664AbYCFAD1 (ORCPT ); Wed, 5 Mar 2008 19:03:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757700AbYCFADO (ORCPT ); Wed, 5 Mar 2008 19:03:14 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:43367 "EHLO ebiederm.dsl.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757619AbYCFADN (ORCPT ); Wed, 5 Mar 2008 19:03:13 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: paulmck@linux.vnet.ibm.com Cc: Pavel Emelyanov , Andrew Morton , David Miller , Linux Netdev List , Linux Kernel Mailing List , "Eric W. Biederman" , Alexey Dobriyan Subject: Re: [PATCH] Make /proc/net a symlink on /proc/self/net References: <47CE8FF7.7000701@openvz.org> <20080305191501.GF8728@linux.vnet.ibm.com> Date: Wed, 05 Mar 2008 16:59:56 -0700 In-Reply-To: <20080305191501.GF8728@linux.vnet.ibm.com> (Paul E. McKenney's message of "Wed, 5 Mar 2008 11:15:01 -0800") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1027 Lines: 36 >> >> +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. Good catch. >> + if (task != NULL) { >> + ns = task_nsproxy(task); >> + if (ns != NULL) >> + net = get_net(ns->net_ns); >> + } >> + rcu_read_unlock(); >> + >> + return net; >> +} >> + -- 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/