mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
dm thin metadata: Avoid returning cmd->bm wild pointer on error
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>
This commit is contained in:
parent
d16ff19e69
commit
219403d7e5
@ -739,12 +739,16 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f
|
||||
THIN_MAX_CONCURRENT_LOCKS);
|
||||
if (IS_ERR(pmd->bm)) {
|
||||
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);
|
||||
if (r)
|
||||
if (r) {
|
||||
dm_block_manager_destroy(pmd->bm);
|
||||
pmd->bm = NULL;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user