linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: devtmpfs default permissions
Date: Thu, 05 Nov 2009 19:42:03 +0000	[thread overview]
Message-ID: <1257450123.2397.1.camel@yio.site> (raw)
In-Reply-To: <1256824970.30238.25.camel@mjollnir>

On Wed, 2009-11-04 at 16:25 +0100, Kay Sievers wrote:
> On Tue, Nov 3, 2009 at 02:24, Mark Rosenstand <rosenstand@gmail.com> 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@vrfy.org>
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@tiscali.co.uk>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
---
 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:


  parent reply	other threads:[~2009-11-05 19:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 14:02 devtmpfs default permissions Mark Rosenstand
2009-10-29 16:35 ` Greg KH
2009-10-29 17:12 ` Kay Sievers
2009-10-29 23:53 ` Mark Rosenstand
2009-10-30 11:48 ` Kay Sievers
2009-11-03  1:24 ` Mark Rosenstand
2009-11-04 15:25 ` Kay Sievers
2009-11-05 19:42 ` Kay Sievers [this message]
2009-11-05 21:01 ` Greg KH
2009-11-05 22:40 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257450123.2397.1.camel@yio.site \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).