Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

devpts: correctly set default options

devpts_get_sb() calls memset(0) to clear mount options and calls
parse_mount_options() if user specified any mount options.

The memset(0) is bogus since the 'mode' and 'ptmxmode' options are
non-zero by default. parse_mount_options() restores options to default
anyway and can properly deal with NULL mount options.

So in devpts_get_sb() remove memset(0) and call parse_mount_options() even
for NULL mount options.

Bug reported by Eric Paris: http://lkml.org/lkml/2009/5/7/448.

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reported-by: Eric Paris <eparis@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Reviewed-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Sukadev Bhattiprolu and committed by
Linus Torvalds
1f71ebed bd67ce0f

+12 -6
+12 -6
fs/devpts/inode.c
··· 90 90 #define PARSE_MOUNT 0 91 91 #define PARSE_REMOUNT 1 92 92 93 + /* 94 + * parse_mount_options(): 95 + * Set @opts to mount options specified in @data. If an option is not 96 + * specified in @data, set it to its default value. The exception is 97 + * 'newinstance' option which can only be set/cleared on a mount (i.e. 98 + * cannot be changed during remount). 99 + * 100 + * Note: @data may be NULL (in which case all options are set to default). 101 + */ 93 102 static int parse_mount_options(char *data, int op, struct pts_mount_opts *opts) 94 103 { 95 104 char *p; ··· 364 355 struct pts_mount_opts opts; 365 356 struct super_block *s; 366 357 367 - memset(&opts, 0, sizeof(opts)); 368 - if (data) { 369 - error = parse_mount_options(data, PARSE_MOUNT, &opts); 370 - if (error) 371 - return error; 372 - } 358 + error = parse_mount_options(data, PARSE_MOUNT, &opts); 359 + if (error) 360 + return error; 373 361 374 362 if (opts.newinstance) 375 363 s = sget(fs_type, NULL, set_anon_super, NULL);