dm thin metadata: Avoid returning cmd->bm wild pointer on error
commit 219403d7e56f9b716ad80ab87db85d29547ee73e upstream. Maybe __create_persistent_data_objects() caller will use PTR_ERR as a pointer, it will lead to some strange things. Signed-off-by: Ye Bin <yebin10@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
67f03c3d68
commit
2c00ee626e
@@ -698,12 +698,16 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f
|
|||||||
THIN_MAX_CONCURRENT_LOCKS);
|
THIN_MAX_CONCURRENT_LOCKS);
|
||||||
if (IS_ERR(pmd->bm)) {
|
if (IS_ERR(pmd->bm)) {
|
||||||
DMERR("could not create block manager");
|
DMERR("could not create block manager");
|
||||||
return PTR_ERR(pmd->bm);
|
r = PTR_ERR(pmd->bm);
|
||||||
|
pmd->bm = NULL;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = __open_or_format_metadata(pmd, format_device);
|
r = __open_or_format_metadata(pmd, format_device);
|
||||||
if (r)
|
if (r) {
|
||||||
dm_block_manager_destroy(pmd->bm);
|
dm_block_manager_destroy(pmd->bm);
|
||||||
|
pmd->bm = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user