From: Mikulas Patocka Date: Mon, 16 Mar 2009 17:44:26 +0000 (+0000) Subject: dm table: rework reference counting fix X-Git-Tag: v2.6.29~30^2~3 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=f80a557008462a0a4adef25407f1872e793d8dd5;p=safe%2Fjmp%2Flinux-2.6 dm table: rework reference counting fix Fix an error introduced in dm-table-rework-reference-counting.patch. When there is failure after table initialization, we need to use dm_table_destroy, not dm_table_put, to free the table. dm_table_put may be used only after dm_table_get. Cc: Kiyoshi Ueda Signed-off-by: Mikulas Patocka Reviewed-by: Jonathan Brassow Reviewed-by: Alasdair G Kergon Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 977f366..f010965 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -1064,7 +1064,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size) r = populate_table(t, param, param_size); if (r) { - dm_table_put(t); + dm_table_destroy(t); goto out; } @@ -1072,7 +1072,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size) hc = dm_get_mdptr(md); if (!hc || hc->md != md) { DMWARN("device has been removed from the dev hash table."); - dm_table_put(t); + dm_table_destroy(t); up_write(&_hash_lock); r = -ENXIO; goto out;