aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorGravatar Ian Kent <raven@themaw.net> 2022-07-02 08:23:47 +0800
committerGravatar Trond Myklebust <trond.myklebust@hammerspace.com> 2022-07-12 10:53:10 -0400
commit8b4e87a1d68f5ae440c42c15c238fd964fd381d0 (patch)
treeb732e2ab86f31a7d0584b294692a85a993dd4b33 /fs/nfs
parentnfs: Replace kmap() with kmap_local_page() (diff)
downloadlinux-8b4e87a1d68f5ae440c42c15c238fd964fd381d0.tar.gz
linux-8b4e87a1d68f5ae440c42c15c238fd964fd381d0.tar.bz2
linux-8b4e87a1d68f5ae440c42c15c238fd964fd381d0.zip
nfs: fix port value parsing
The valid values of nfs options port and mountport are 0 to USHRT_MAX. The fs parser will return a fail for port values that are negative and the sloppy option handling then returns success. But the sloppy option handling is meant to return success for invalid options not valid options with invalid values. Restricting the sloppy option override to handle failure returns for invalid options only is sufficient to resolve this problem. Changes: v2: utilize the return value from fs_parse() to resolve this problem instead of changing the parameter definitions. Suggested-by: Trond Myklebust <trondmy@hammerspace.com> Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/fs_context.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index 9a16897e8dc6..8f1f9b4af89d 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -484,7 +484,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
opt = fs_parse(fc, nfs_fs_parameters, param, &result);
if (opt < 0)
- return ctx->sloppy ? 1 : opt;
+ return (opt == -ENOPARAM && ctx->sloppy) ? 1 : opt;
if (fc->security)
ctx->has_sec_mnt_opts = 1;