diff options
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r-- | fs/nfs/super.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 18d446e1a82b..d39601381adf 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -923,6 +923,8 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void) | |||
923 | 923 | ||
924 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 924 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
925 | if (data) { | 925 | if (data) { |
926 | data->timeo = NFS_UNSPEC_TIMEO; | ||
927 | data->retrans = NFS_UNSPEC_RETRANS; | ||
926 | data->acregmin = NFS_DEF_ACREGMIN; | 928 | data->acregmin = NFS_DEF_ACREGMIN; |
927 | data->acregmax = NFS_DEF_ACREGMAX; | 929 | data->acregmax = NFS_DEF_ACREGMAX; |
928 | data->acdirmin = NFS_DEF_ACDIRMIN; | 930 | data->acdirmin = NFS_DEF_ACDIRMIN; |
@@ -1189,6 +1191,19 @@ static int nfs_get_option_ul(substring_t args[], unsigned long *option) | |||
1189 | return rc; | 1191 | return rc; |
1190 | } | 1192 | } |
1191 | 1193 | ||
1194 | static int nfs_get_option_ul_bound(substring_t args[], unsigned long *option, | ||
1195 | unsigned long l_bound, unsigned long u_bound) | ||
1196 | { | ||
1197 | int ret; | ||
1198 | |||
1199 | ret = nfs_get_option_ul(args, option); | ||
1200 | if (ret != 0) | ||
1201 | return ret; | ||
1202 | if (*option < l_bound || *option > u_bound) | ||
1203 | return -ERANGE; | ||
1204 | return 0; | ||
1205 | } | ||
1206 | |||
1192 | /* | 1207 | /* |
1193 | * Error-check and convert a string of mount options from user space into | 1208 | * Error-check and convert a string of mount options from user space into |
1194 | * a data structure. The whole mount string is processed; bad options are | 1209 | * a data structure. The whole mount string is processed; bad options are |
@@ -1352,12 +1367,12 @@ static int nfs_parse_mount_options(char *raw, | |||
1352 | mnt->bsize = option; | 1367 | mnt->bsize = option; |
1353 | break; | 1368 | break; |
1354 | case Opt_timeo: | 1369 | case Opt_timeo: |
1355 | if (nfs_get_option_ul(args, &option) || option == 0) | 1370 | if (nfs_get_option_ul_bound(args, &option, 1, INT_MAX)) |
1356 | goto out_invalid_value; | 1371 | goto out_invalid_value; |
1357 | mnt->timeo = option; | 1372 | mnt->timeo = option; |
1358 | break; | 1373 | break; |
1359 | case Opt_retrans: | 1374 | case Opt_retrans: |
1360 | if (nfs_get_option_ul(args, &option) || option == 0) | 1375 | if (nfs_get_option_ul_bound(args, &option, 0, INT_MAX)) |
1361 | goto out_invalid_value; | 1376 | goto out_invalid_value; |
1362 | mnt->retrans = option; | 1377 | mnt->retrans = option; |
1363 | break; | 1378 | break; |