diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-06-22 05:08:02 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-06-22 05:08:02 -0400 |
commit | 0e0497c0c017664994819f4602dc07fd95896c52 (patch) | |
tree | d6a70d29e5eae6ca9cf3ca197db9f0ab8a3b5e51 /drivers/md/dm-mpath.c | |
parent | f234012f52a37e48f2330e1ca2df69800e797c3b (diff) |
dm mpath: validate table argument count
The parser reads the argument count as a number but doesn't check that
sufficient arguments are supplied. This command triggers the bug:
dmsetup create mpath --table "0 `blockdev --getsize /dev/mapper/cr0`
multipath 0 0 2 1 round-robin 1000 0 1 1 /dev/mapper/cr0
round-robin 0 1 1 /dev/mapper/cr1 1000"
kernel BUG at drivers/md/dm-mpath.c:530!
Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r-- | drivers/md/dm-mpath.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6a386ab4f7eb..d880299334e9 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -553,6 +553,12 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg, | |||
553 | return -EINVAL; | 553 | return -EINVAL; |
554 | } | 554 | } |
555 | 555 | ||
556 | if (ps_argc > as->argc) { | ||
557 | dm_put_path_selector(pst); | ||
558 | ti->error = "not enough arguments for path selector"; | ||
559 | return -EINVAL; | ||
560 | } | ||
561 | |||
556 | r = pst->create(&pg->ps, ps_argc, as->argv); | 562 | r = pst->create(&pg->ps, ps_argc, as->argv); |
557 | if (r) { | 563 | if (r) { |
558 | dm_put_path_selector(pst); | 564 | dm_put_path_selector(pst); |