ncpfs: fix error return code in ncp_parse_options()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 8 Jul 2013 23:00:44 +0000 (16:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Jul 2013 17:33:25 +0000 (10:33 -0700)
Fix to return -EINVAL from the option parse error handling case instead
of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ncpfs/inode.c

index 0765ad1..4659da6 100644 (file)
@@ -403,18 +403,24 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
                switch (optval) {
                        case 'u':
                                data->uid = make_kuid(current_user_ns(), optint);
-                               if (!uid_valid(data->uid))
+                               if (!uid_valid(data->uid)) {
+                                       ret = -EINVAL;
                                        goto err;
+                               }
                                break;
                        case 'g':
                                data->gid = make_kgid(current_user_ns(), optint);
-                               if (!gid_valid(data->gid))
+                               if (!gid_valid(data->gid)) {
+                                       ret = -EINVAL;
                                        goto err;
+                               }
                                break;
                        case 'o':
                                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;
+                               }
                                break;
                        case 'm':
                                data->file_mode = optint;