[PATCH] vfs: parse sloppy mount option in correct order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With addition of fs_context support, options string is parsed
sequentially, if 'sloppy' option is not leftmost one, we may
return ENOPARAM to userland if a non-valid option preceeds sloopy
and mount will fail :

host# mount -o quota,sloppy 172.23.1.225:/share /mnt
mount.nfs: an incorrect mount option was specified
host# mount -o sloppy,quota 172.23.1.225:/share /mnt
host#

This patch correct that behaviour so that sloppy takes precedence
if specified anywhere on the string

Signed-off-by: Roberto Bergantinos Corpas <rbergant@xxxxxxxxxx>
---
 fs/fs_context.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index de1985eae535..f930808e9db8 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -210,8 +210,12 @@ int generic_parse_monolithic(struct fs_context *fc, void *data)
 	if (ret)
 		return ret;
 
+	/* 'sloppy' should be parsed first */
+	if (strstr((const char *)data, "sloppy") != NULL)
+		vfs_parse_fs_string(fc, "sloppy", NULL, 0);
+
 	while ((key = strsep(&options, ",")) != NULL) {
-		if (*key) {
+		if (*key && strcmp(key, "sloppy")) {
 			size_t v_len = 0;
 			char *value = strchr(key, '=');
 
-- 
2.31.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux