diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2013-11-22 19:51:39 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-01-07 10:11:44 -0500 |
commit | 57a2f238564e0700c8648238d31f366246a5b963 (patch) | |
tree | ec5ec772a766a1cb56b83dc98280424ec20791ef /block/elevator.c | |
parent | 19fa1a6756ed9e92daa9537c03b47d6b55cc2316 (diff) | |
download | linux-57a2f238564e0700c8648238d31f366246a5b963.tar.gz linux-57a2f238564e0700c8648238d31f366246a5b963.tar.bz2 linux-57a2f238564e0700c8648238d31f366246a5b963.zip |
dm table: remove unused buggy code that extends the targets array
A device mapper table is allocated in the following way:
* The function dm_table_create is called, it gets the number of targets
as an argument -- it allocates a targets array accordingly.
* For each target, we call dm_table_add_target.
If we add more targets than were specified in dm_table_create, the
function dm_table_add_target reallocates the targets array. However,
this reallocation code is wrong - it moves the targets array to a new
location, while some target constructors hold pointers to the array in
the old location.
The following DM target drivers save the pointer to the target
structure, so they corrupt memory if the target array is moved:
multipath, raid, mirror, snapshot, stripe, switch, thin, verity.
Under normal circumstances, the reallocation function is not called
(because dm_table_create is called with the correct number of targets),
so the buggy reallocation code is not used.
Prior to the fix "dm table: fail dm_table_create on dm_round_up
overflow", the reallocation code could only be used in case the user
specifies too large a value in param->target_count, such as 0xffffffff.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'block/elevator.c')
0 files changed, 0 insertions, 0 deletions