[056/111] Btrfs: fail mount on bad mount options

From: Greg KH
Date: Wed Aug 11 2010 - 20:37:06 EST


2.6.32-stable review patch. If anyone has any objections, please let us know.

------------------

From: Sage Weil <sage@xxxxxxxxxxxx>

commit a7a3f7cadd9bdee569243f7ead9550aa16b60e07 upstream.

We shouldn't silently ignore unrecognized options.

Signed-off-by: Sage Weil <sage@xxxxxxxxxxxx>
Signed-off-by: Chris Mason <chris.mason@xxxxxxxxxx>
Acked-by: Jeff Mahoney <jeffm@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
fs/btrfs/super.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -128,6 +128,7 @@ int btrfs_parse_options(struct btrfs_roo
substring_t args[MAX_OPT_ARGS];
char *p, *num;
int intarg;
+ int ret = 0;

if (!options)
return 0;
@@ -262,12 +263,18 @@ int btrfs_parse_options(struct btrfs_roo
case Opt_discard:
btrfs_set_opt(info->mount_opt, DISCARD);
break;
+ case Opt_err:
+ printk(KERN_INFO "btrfs: unrecognized mount option "
+ "'%s'\n", p);
+ ret = -EINVAL;
+ goto out;
default:
break;
}
}
+out:
kfree(options);
- return 0;
+ return ret;
}

/*


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