diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 72935f665f11..0f20d6c5e4bd 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -818,7 +818,11 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, struct ceph_options *opt) { struct ceph_fs_client *fsc; - int err; + int err, num_mon; + + num_mon = opt->num_mon; + if (num_mon == 0 || num_mon > CEPH_MAX_MON) + return ERR_PTR(-EINVAL); fsc = kzalloc_obj(*fsc); if (!fsc) {