@@ -532,7 +532,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
else
num = simple_strtol(vers, &minorp, 0);
if (*minorp == '.') {
- if (num < 4)
+ if (num < 4 || num >= nfsd_number_vers())
return -EINVAL;
minor = simple_strtoul(minorp+1, NULL, 0);
if (minor == 0)
@@ -104,6 +104,7 @@ int nfsd_vers(int vers, enum vers_op change);
int nfsd_minorversion(u32 minorversion, enum vers_op change);
void nfsd_reset_versions(void);
int nfsd_create_serv(void);
+int nfsd_number_vers(void);
extern int nfsd_max_blksize;
@@ -670,3 +670,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file)
mutex_unlock(&nfsd_mutex);
return ret;
}
+
+int nfsd_number_vers(void) {
+ return NFSD_NRVERS;
+}
when enable or disable the minorversion throw /proc/fs/nfsd/versions,it should check the support version. for example if we do like following: echo "+2 +3 +4 +7.1">/proc/fs/nfsd/versions echo "+2 +3 +4 -7.1">/proc/fs/nfsd/versions it will enable or disable nfs4.1, but now the number nfs7 didn't support. Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com> --- fs/nfsd/nfsctl.c | 2 +- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfssvc.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-)