@@ -990,6 +990,7 @@ static int parse_features(struct mirror_set *ms, unsigned argc, char **argv,
unsigned num_features;
struct dm_target *ti = ms->ti;
char dummy;
+ int i;
*args_used = 0;
@@ -1010,19 +1011,18 @@ static int parse_features(struct mirror_set *ms, unsigned argc, char **argv,
return -EINVAL;
}
- if (!strcmp("handle_errors", argv[0]))
- ms->features |= DM_RAID1_HANDLE_ERRORS;
- else {
- ti->error = "Unrecognised feature requested";
- return -EINVAL;
- }
-
- argc--;
- argv++;
- (*args_used)++;
+ for (i = 0; i < num_features; i++) {
+ if (!strcmp("handle_errors", argv[0]))
+ ms->features |= DM_RAID1_HANDLE_ERRORS;
+ else if (!strcmp("keep_log", argv[0]))
+ ms->features |= DM_RAID1_KEEP_LOG;
+ else {
+ ti->error = "Unrecognised feature requested";
+ return -EINVAL;
+ }
- if (!strcmp("keep_log", argv[0])) {
- ms->features |= DM_RAID1_KEEP_LOG;
+ argc--;
+ argv++;
(*args_used)++;
}
If the userspace does not pass the new feature parameter, it will lead to a kernel crash Signed-off-by: Lidong Zhong <lzhong@suse.com> --- drivers/md/dm-raid1.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)