diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-06-22 10:08:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-02 16:40:58 -0700 |
commit | 4869fdea77052c480c54b9e66a927ba036eab29e (patch) | |
tree | d137236bcde8b921d7126987aef5601bdcec03d9 | |
parent | f42f498bee4760d4db6f55cfab98f42ae7660e1c (diff) | |
download | lwn-4869fdea77052c480c54b9e66a927ba036eab29e.tar.gz lwn-4869fdea77052c480c54b9e66a927ba036eab29e.zip |
dm mpath: validate table argument count
commit 0e0497c0c017664994819f4602dc07fd95896c52 upstream.
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!
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-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 095f77bf9681..736f1d97ea2c 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -554,6 +554,12 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg, return -EINVAL; } + if (ps_argc > as->argc) { + dm_put_path_selector(pst); + ti->error = "not enough arguments for path selector"; + return -EINVAL; + } + r = pst->create(&pg->ps, ps_argc, as->argv); if (r) { dm_put_path_selector(pst); |