Skip to content

Commit

Permalink
ceph: Only allow mounts in the initial network namespace
Browse files Browse the repository at this point in the history
Today ceph opens tcp sockets from a delayed work callback.  Delayed
work happens from kernel threads which are always in the initial
network namespace.   Therefore fail early if someone attempts
to mount a ceph filesystem from something other than the initial
network namespace.

Cc: Sage Weil <sage@inktank.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed Feb 12, 2013
1 parent bc1b69e commit eea553c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/ceph/ceph_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <linux/slab.h>
#include <linux/statfs.h>
#include <linux/string.h>
#include <linux/nsproxy.h>
#include <net/net_namespace.h>


#include <linux/ceph/ceph_features.h>
Expand Down Expand Up @@ -292,6 +294,9 @@ ceph_parse_options(char *options, const char *dev_name,
int err = -ENOMEM;
substring_t argstr[MAX_OPT_ARGS];

if (current->nsproxy->net_ns != &init_net)
return ERR_PTR(-EINVAL);

opt = kzalloc(sizeof(*opt), GFP_KERNEL);
if (!opt)
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit eea553c

Please sign in to comment.