[Devel] [PATCH RHEL7 COMMIT] fuse: Fix parse_fuse_opt() return values wrong interpretation

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 31 13:55:53 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.15
------>
commit d26da18e8e649213f491b740ecaaf38807507d42
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Oct 31 13:55:51 2018 +0300

    fuse: Fix parse_fuse_opt() return values wrong interpretation
    
    This function returns not 0 in case of success, and 0 in case
    of failure. So, error values like -EPERM are interpreted as
    success, which is wrong. Fix that.
    Note, that fuse has generic EINVAL return value for all types
    of unacceptable parameters.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/inode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index ca9a146d39fa..0695b79c4c50 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -688,19 +688,19 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
 
 		case OPT_WBCACHE:
 			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
-				return -EPERM;
+				return 0;
 			d->writeback_cache = 1;
 			break;
 
 		case OPT_ODIRECT:
 			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
-				return -EPERM;
+				return 0;
 			d->flags |= FUSE_ODIRECT;
 			break;
 
 		case OPT_UMOUNT_WAIT:
 			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
-				return -EPERM;
+				return 0;
 			d->flags |= FUSE_UMOUNT_WAIT;
 			break;
 
@@ -711,7 +711,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
 			char *name;
 			name = match_strdup(&args[0]);
 			if (!name)
-				return 1;
+				return 0;
 
 			strncpy(d->kio_name, name, FUSE_KIO_NAME);
 			d->flags |= FUSE_KDIRECT_IO;



More information about the Devel mailing list