public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public•gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public•gmane.org>
Cc: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public•gmane.org>,
	Ulrich Drepper <drepper-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Jonathan Corbet <corbet-T1hC0tSOHrs@public•gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Jan Engelhardt <jengelh-nopoi9nDyk+ELgA04lAiVw@public•gmane.org>,
	Linux Containers
	<containers-qjLDD68F18O7TbgM5vRIOg@public•gmane.org>,
	Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public•gmane.org>,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Michael Kerrisk
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org>,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public•gmane.org>,
	Sukadev Bhattiprolu
	<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public•gmane.org>,
	Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public•gmane.org>,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org>,
	Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public•gmane.org>
Subject: Re: [PATCH 7/8] net: Allow setting the network namespace by fd
Date: Fri, 24 Sep 2010 15:46:28 +0200	[thread overview]
Message-ID: <4C9CABB4.3010002@fr.ibm.com> (raw)
In-Reply-To: <m1hbhgq1v1.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>

On 09/23/2010 10:51 AM, Eric W. Biederman wrote:
>
> Take advantage of the new abstraction and allow network devices
> to be placed in any network namespace that we have a fd to talk
> about.
>
> Signed-off-by: Eric W. Biederman<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public•gmane.org>
> ---

[ ... ]

> +struct net *get_net_ns_by_fd(int fd)
> +{
> +	struct proc_inode *ei;
> +	struct file *file;
> +	struct net *net;
> +
> +	file = NULL;
> +	net = ERR_PTR(-EINVAL);
> +	file = proc_ns_fget(fd);
> +	if (!fd)
> +		goto out;
> +		return ERR_PTR(-EINVAL);
> +
> +	ei = PROC_I(file->f_dentry->d_inode);
> +	if (ei->ns_ops !=&netns_operations)
> +		goto out;

Is this check necessary here ? proc_ns_fget checks "file->f_op != 
&ns_file_operations", no ?

  parent reply	other threads:[~2010-09-24 13:46 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23  8:45 [ABI REVIEW][PATCH 0/8] Namespace file descriptors Eric W. Biederman
2010-09-23  8:46 ` [PATCH 1/8] ns: proc files for namespace naming policy Eric W. Biederman
2010-09-23  8:46 ` [PATCH 2/8] ns: Introduce the setns syscall Eric W. Biederman
2010-09-23  8:47 ` [PATCH 3/8] ns proc: Add support for the network namespace Eric W. Biederman
2010-09-23 11:27   ` Louis Rilling
2010-09-23 16:00     ` Eric W. Biederman
2010-09-23  8:48 ` [PATCH 4/8] ns proc: Add support for the uts namespace Eric W. Biederman
2010-09-23  8:49 ` [PATCH 5/8] ns proc: Add support for the ipc namespace Eric W. Biederman
2010-09-23  8:50 ` [PATCH 6/8] ns proc: Add support for the mount namespace Eric W. Biederman
     [not found] ` <m1ocborgq7.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-09-23  8:51   ` [PATCH 7/8] net: Allow setting the network namespace by fd Eric W. Biederman
2010-09-23  9:41     ` Eric Dumazet
2010-09-23 16:03       ` Eric W. Biederman
2010-09-23 11:22     ` jamal
2010-09-23 14:58       ` David Lamparter
2010-09-24 11:51         ` jamal
2010-09-24 12:57           ` David Lamparter
2010-09-24 13:32             ` jamal
2010-09-24 14:09               ` David Lamparter
2010-09-24 14:16                 ` jamal
2010-09-23 15:14       ` Eric W. Biederman
2010-09-23 14:22     ` Brian Haley
2010-09-23 16:16       ` Eric W. Biederman
     [not found]     ` <m1hbhgq1v1.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2010-09-24 13:46       ` Daniel Lezcano [this message]
2010-09-23  8:51   ` [PATCH 8/8] net: Implement socketat Eric W. Biederman
2010-09-23  8:56     ` Pavel Emelyanov
2010-09-23 11:19       ` jamal
2010-09-23 11:33         ` Pavel Emelyanov
     [not found]           ` <4C9B3B06.900-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2010-09-23 11:40             ` jamal
2010-09-23 11:53               ` Pavel Emelyanov
2010-09-23 12:11                 ` jamal
2010-09-23 12:34                   ` Pavel Emelyanov
2010-09-23 14:54                     ` David Lamparter
2010-09-23 15:00                     ` Eric W. Biederman
2010-10-02 21:13                 ` Daniel Lezcano
2010-10-03 13:44                   ` jamal
2010-10-04 10:13                     ` Daniel Lezcano
2010-10-04 19:07                     ` Eric W. Biederman
2010-10-15 12:30                     ` netns patches WAS( " jamal
2010-10-26 20:52                       ` jamal
2010-10-27  0:27                         ` Eric W. Biederman
2010-09-23 15:18 ` [ABI REVIEW][PATCH 0/8] Namespace file descriptors David Lamparter
2010-09-23 16:32   ` Eric W. Biederman
2010-09-23 16:49     ` David Lamparter
2010-09-24 13:02 ` Andrew Lutomirski
2010-09-24 13:49   ` Daniel Lezcano
2010-09-24 17:06     ` Eric W. Biederman
2010-09-29  3:09 ` Rémi Denis-Courmont

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=4C9CABB4.3010002@fr.ibm.com \
    --to=dlezcano-nmtc/0zbporqt0dzr+alfa@public$(echo .)gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public$(echo .)gmane.org \
    --cc=corbet-T1hC0tSOHrs@public$(echo .)gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
    --cc=drepper-Re5JQEeQqe8AvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public$(echo .)gmane.org \
    --cc=greearb-my8/4N5VtI7c+919tysfdA@public$(echo .)gmane.org \
    --cc=jengelh-nopoi9nDyk+ELgA04lAiVw@public$(echo .)gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public$(echo .)gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public$(echo .)gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public$(echo .)gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public$(echo .)gmane.org \
    --cc=xemul-bzQdu9zFT3WakBO8gow8eQ@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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