aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2013-01-31 05:09:50 -0500
committerEric W. Biederman <ebiederm@xmission.com>2013-02-12 06:19:23 -0500
commiteea553c21fbfa486978c82525ee8256239d4f921 (patch)
tree45b6b0b51fd59806aa1e8836a1f563918b02eab4 /net/ceph
parentbc1b69ed22a704fb1cc83d75b2eb46508a06c820 (diff)
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: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/ceph_common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index ee71ea26777a..1deb29af82fd 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -15,6 +15,8 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/statfs.h> 16#include <linux/statfs.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/nsproxy.h>
19#include <net/net_namespace.h>
18 20
19 21
20#include <linux/ceph/ceph_features.h> 22#include <linux/ceph/ceph_features.h>
@@ -292,6 +294,9 @@ ceph_parse_options(char *options, const char *dev_name,
292 int err = -ENOMEM; 294 int err = -ENOMEM;
293 substring_t argstr[MAX_OPT_ARGS]; 295 substring_t argstr[MAX_OPT_ARGS];
294 296
297 if (current->nsproxy->net_ns != &init_net)
298 return ERR_PTR(-EINVAL);
299
295 opt = kzalloc(sizeof(*opt), GFP_KERNEL); 300 opt = kzalloc(sizeof(*opt), GFP_KERNEL);
296 if (!opt) 301 if (!opt)
297 return ERR_PTR(-ENOMEM); 302 return ERR_PTR(-ENOMEM);