Re: devtmpfs default permissions

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

 



On Wed, 2009-11-04 at 16:25 +0100, Kay Sievers wrote:
> On Tue, Nov 3, 2009 at 02:24, Mark Rosenstand <rosenstand@xxxxxxxxx> wrote:
> > Works here too. Getting this on the console, though:
> >
> > tmpfs: No value for mount option 'mode'
> >
> > But hey, it works. Thanks :)
> 
> Yeah, the tmpfs code mangles *data, and as we get a single superblock,
> remount is called during mount, and the tmpfs code tries to parse
> *data again which it destroyed in the first run. It's harmless and
> needs to be fixed, but I'm not sure which piece to fix at the moment.
> :)

This seems to work here.

Thanks,
Kay


From: Kay Sievers <kay.sievers@xxxxxxxx>
Subject: tmpfs: zap options after mangling them during parsing

Zap options list we have destroyed during parsing, to prevent
errors on repeated calls, like in the case we do kern_mount()
which might do an implicit remount() call.

Cc: Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx>
Signed-off-by: Kay Sievers <kay.sievers@xxxxxxxx>
---
 mm/shmem.c |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2147,22 +2147,26 @@ static const struct export_operations sh
 static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
 			       bool remount)
 {
-	char *this_char, *value, *rest;
+	char *option, *value, *this_char, *rest;
 
-	while (options != NULL) {
-		this_char = options;
+	if (!options || !options[0])
+		return 0;
+
+	option = options;
+	while (option != NULL) {
+		this_char = option;
 		for (;;) {
 			/*
 			 * NUL-terminate this option: unfortunately,
 			 * mount options form a comma-separated list,
 			 * but mpol's nodelist may also contain commas.
 			 */
-			options = strchr(options, ',');
-			if (options == NULL)
+			option = strchr(option, ',');
+			if (option == NULL)
 				break;
-			options++;
-			if (!isdigit(*options)) {
-				options[-1] = '\0';
+			option++;
+			if (!isdigit(*option)) {
+				option[-1] = '\0';
 				break;
 			}
 		}
@@ -2225,6 +2229,12 @@ static int shmem_parse_options(char *opt
 			return 1;
 		}
 	}
+	/*
+	 * Zap options list we have destroyed during parsing, to prevent
+	 * errors on repeated calls, like in the case we do kern_mount()
+	 * which might do an implicit remount() call.
+	 */
+	options[0] = '\0';
 	return 0;
 
 bad_val:

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux