Patch "ovl: fix regression in parsing of mount options with escaped comma" has been added to the 6.5-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    ovl: fix regression in parsing of mount options with escaped comma

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ovl-fix-regression-in-parsing-of-mount-options-with-.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2173505925ac9b7d66ba7765aca6bbdc9722bf92
Author: Amir Goldstein <amir73il@xxxxxxxxx>
Date:   Thu Oct 12 16:08:28 2023 +0300

    ovl: fix regression in parsing of mount options with escaped comma
    
    [ Upstream commit c34706acf40b43dd31f67c92c5a95d39666a1eb3 ]
    
    Ever since commit 91c77947133f ("ovl: allow filenames with comma"), the
    following example was legit overlayfs mount options:
    
      mount -t overlay overlay -o 'lowerdir=/tmp/a\,b/lower' /mnt
    
    The conversion to new mount api moved to using the common helper
    generic_parse_monolithic() and discarded the specialized ovl_next_opt()
    option separator.
    
    Bring back ovl_next_opt() and use vfs_parse_monolithic_sep() to fix the
    regression.
    
    Reported-by: Ryan Hendrickson <ryan.hendrickson@xxxxxxxxxxxx>
    Closes: https://lore.kernel.org/r/8da307fb-9318-cf78-8a27-ba5c5a0aef6d@xxxxxxxxxxxx/
    Fixes: 1784fbc2ed9c ("ovl: port to new mount api")
    Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index c69d97aef2cf9..c0f70af422d6c 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -120,6 +120,34 @@ const struct fs_parameter_spec ovl_parameter_spec[] = {
 	{}
 };
 
+static char *ovl_next_opt(char **s)
+{
+	char *sbegin = *s;
+	char *p;
+
+	if (sbegin == NULL)
+		return NULL;
+
+	for (p = sbegin; *p; p++) {
+		if (*p == '\\') {
+			p++;
+			if (!*p)
+				break;
+		} else if (*p == ',') {
+			*p = '\0';
+			*s = p + 1;
+			return sbegin;
+		}
+	}
+	*s = NULL;
+	return sbegin;
+}
+
+static int ovl_parse_monolithic(struct fs_context *fc, void *data)
+{
+	return vfs_parse_monolithic_sep(fc, data, ovl_next_opt);
+}
+
 static ssize_t ovl_parse_param_split_lowerdirs(char *str)
 {
 	ssize_t nr_layers = 1, nr_colons = 0;
@@ -596,6 +624,7 @@ static int ovl_reconfigure(struct fs_context *fc)
 }
 
 static const struct fs_context_operations ovl_context_ops = {
+	.parse_monolithic = ovl_parse_monolithic,
 	.parse_param = ovl_parse_param,
 	.get_tree    = ovl_get_tree,
 	.reconfigure = ovl_reconfigure,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux