Skip to contentSkip to conversation

smb: client: fix regression with mount options parsing

PATCH Applied Paulo Alcantara 2 participants 2 messages Feb 11

Subsystems (2)
lore
Share & tools
lore

Paulo Alcantara

author maintainer
#0 lore raw

PATCH 1/1 smb: client: fix regression with mount options parsing

After commit 1ef15fbe6771 ("cifs: client: enforce consistent handling of multichannel and max_channels"), invalid mount options started to be ignored, allowing cifs.ko to proceed with the mount instead of baling out.

The problem was related to smb3_handle_conflicting_options() being called even when an invalid parameter had been parsed, overwriting the return value of vfs_parse_fs_string() in smb3_fs_context_parse_monolithic().

Fix this by calling smb3_handle_conflicting_options() only when a valid mount option has been passed.

Reproducer:

$ mount.cifs //srv/share /mnt -o ${opts}
$ mount -o remount,foo,${opts} /mnt # must fail
Fixes 1ef15fbe6771 ("cifs: client: enforce consistent handling of multichannel and max_channels")
Cc David Howells <[email protected]>
---
 fs/smb/client/fs_context.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/smb/client/fs_context.c +1 -3
index ec84204aee18..412c5b534791 100644
@@ -825,9 +825,7 @@ static int smb3_fs_context_parse_monolithic(struct fs_context *fc,
 		if (ret < 0)
 			break;
 	}
-	ret = smb3_handle_conflicting_options(fc);
-
-	return ret;
+	return ret ?: smb3_handle_conflicting_options(fc);
 }
 
 /*
Signature · 1 line
2.53.0
Applied
#1 lore raw

merged into cifs-2.6.git for-next

Quoted 46 lines · Paulo Alcantara

After commit 1ef15fbe6771 ("cifs: client: enforce consistent handling of multichannel and max_channels"), invalid mount options started to be ignored, allowing cifs.ko to proceed with the mount instead of baling out.

The problem was related to smb3_handle_conflicting_options() being called even when an invalid parameter had been parsed, overwriting the return value of vfs_parse_fs_string() in smb3_fs_context_parse_monolithic().

Fix this by calling smb3_handle_conflicting_options() only when a valid mount option has been passed.

Reproducer:

$ mount.cifs //srv/share /mnt -o ${opts}
$ mount -o remount,foo,${opts} /mnt # must fail
Fixes 1ef15fbe6771 ("cifs: client: enforce consistent handling of multichannel and max_channels")
Cc David Howells <[email protected]>
---
 fs/smb/client/fs_context.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/smb/client/fs_context.c +1 -4
index ec84204aee18..412c5b534791 100644
@@ -825,9 +825,7 @@ static int smb3_fs_context_parse_monolithic(struct fs_context *fc,
                if (ret < 0)
                        break;
        }
-       ret = smb3_handle_conflicting_options(fc);
-
-       return ret;
+       return ret ?: smb3_handle_conflicting_options(fc);
 }
 
 /*
--

2.53.0

Signature · 3 lines
Thanks,

Steve