Commit 2417898b authored by Wei Yongjun's avatar Wei Yongjun Committed by Linus Torvalds

ncpfs: fix error return code in ncp_parse_options()

Fix to return -EINVAL from the option parse error handling case instead
of 0, as done elsewhere in this function.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c707a81d
...@@ -403,18 +403,24 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options) ...@@ -403,18 +403,24 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
switch (optval) { switch (optval) {
case 'u': case 'u':
data->uid = make_kuid(current_user_ns(), optint); data->uid = make_kuid(current_user_ns(), optint);
if (!uid_valid(data->uid)) if (!uid_valid(data->uid)) {
ret = -EINVAL;
goto err; goto err;
}
break; break;
case 'g': case 'g':
data->gid = make_kgid(current_user_ns(), optint); data->gid = make_kgid(current_user_ns(), optint);
if (!gid_valid(data->gid)) if (!gid_valid(data->gid)) {
ret = -EINVAL;
goto err; goto err;
}
break; break;
case 'o': case 'o':
data->mounted_uid = make_kuid(current_user_ns(), optint); data->mounted_uid = make_kuid(current_user_ns(), optint);
if (!uid_valid(data->mounted_uid)) if (!uid_valid(data->mounted_uid)) {
ret = -EINVAL;
goto err; goto err;
}
break; break;
case 'm': case 'm':
data->file_mode = optint; data->file_mode = optint;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment