Commit eea553c2 authored by Eric W. Biederman's avatar Eric W. Biederman

ceph: Only allow mounts in the initial network namespace

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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent bc1b69ed
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/statfs.h> #include <linux/statfs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/nsproxy.h>
#include <net/net_namespace.h>
#include <linux/ceph/ceph_features.h> #include <linux/ceph/ceph_features.h>
...@@ -292,6 +294,9 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -292,6 +294,9 @@ ceph_parse_options(char *options, const char *dev_name,
int err = -ENOMEM; int err = -ENOMEM;
substring_t argstr[MAX_OPT_ARGS]; substring_t argstr[MAX_OPT_ARGS];
if (current->nsproxy->net_ns != &init_net)
return ERR_PTR(-EINVAL);
opt = kzalloc(sizeof(*opt), GFP_KERNEL); opt = kzalloc(sizeof(*opt), GFP_KERNEL);
if (!opt) if (!opt)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment