From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Thu, 05 Nov 2009 19:42:03 +0000 Subject: Re: devtmpfs default permissions Message-Id: <1257450123.2397.1.camel@yio.site> List-Id: References: <1256824970.30238.25.camel@mjollnir> In-Reply-To: <1256824970.30238.25.camel@mjollnir> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Wed, 2009-11-04 at 16:25 +0100, Kay Sievers wrote: > On Tue, Nov 3, 2009 at 02:24, Mark Rosenstand 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 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 Signed-off-by: Kay Sievers --- 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: