From: Hans Reiser This patch fixes a bug in reiser4_parse_options's error handing code path. Signed-off-by: Andrew Morton --- 25-akpm/fs/reiser4/vfs_ops.c | 52 +++++++++++++++++++++++-------------------- 1 files changed, 28 insertions(+), 24 deletions(-) diff -puN fs/reiser4/vfs_ops.c~reiser4-fix-mount-option-parsing fs/reiser4/vfs_ops.c --- 25/fs/reiser4/vfs_ops.c~reiser4-fix-mount-option-parsing 2004-09-20 11:06:04.525905104 -0700 +++ 25-akpm/fs/reiser4/vfs_ops.c 2004-09-20 11:06:04.530904344 -0700 @@ -792,13 +792,18 @@ parse_option(char *opt_string /* startin break; case OPT_ONEOF:{ int i = 0; + + if (val_start == NULL) { + err_msg = "Value is missing"; + result = RETERR(-EINVAL); + break; + } err_msg = "Wrong option value"; result = RETERR(-EINVAL); while ( opt->u.oneof.list[i] ) { if ( !strcmp(opt->u.oneof.list[i], val_start) ) { result = 0; *opt->u.oneof.result = i; -printk("%s choice is %d\n",opt->name, i); break; } i++; @@ -1018,39 +1023,38 @@ do { \ FLAGS - combination of bits: RA_ADJCENT_ONLY, RA_ALL_LEVELS, CONTINUE_ON_PRESENT */ .name = "readahead", - .type = OPT_FORMAT, - .u = { - .f = { - .format = "%u:%u", - .nr_args = 2, - .arg1 = &sbinfo->ra_params.max, - .arg2 = &sbinfo->ra_params.flags, - .arg3 = NULL, - .arg4 = NULL - } - } - + .type = OPT_FORMAT, + .u = { + .f = { + .format = "%u:%u", + .nr_args = 2, + .arg1 = &sbinfo->ra_params.max, + .arg2 = &sbinfo->ra_params.flags, + .arg3 = NULL, + .arg4 = NULL + } + } }); /* What to do in case of fs error */ PUSH_OPT ({ .name = "onerror", - .type = OPT_ONEOF, - .u = { - .oneof = { - .result = &sbinfo->onerror, - .list = {"panic", "remount-ro", "reboot", NULL}, - } - } + .type = OPT_ONEOF, + .u = { + .oneof = { + .result = &sbinfo->onerror, + .list = {"panic", "remount-ro", "reboot", NULL}, + } + } }); #if REISER4_LOG PUSH_OPT({ .name = "log_file", - .type = OPT_STRING, - .u = { - .string = &log_file_name - } + .type = OPT_STRING, + .u = { + .string = &log_file_name + } }); #endif _