mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
dm thin metadata: fix superblock refcount leak on snapshot shadow failure
__reserve_metadata_snap() increments THIN_SUPERBLOCK_LOCATION in the
metadata space map before shadowing it. When dm_tm_shadow_block()
fails, a reference is leaked in the metadata space map.
Fix by adding the missing dm_sm_dec_block().
Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: cc8394d86f ("dm thin: provide userspace access to pool metadata")
Cc: stable@vger.kernel.org
This commit is contained in:
committed by
Mikulas Patocka
parent
386df1a57b
commit
4b22d0801f
@@ -1362,8 +1362,10 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd)
|
||||
dm_sm_inc_block(pmd->metadata_sm, THIN_SUPERBLOCK_LOCATION);
|
||||
r = dm_tm_shadow_block(pmd->tm, THIN_SUPERBLOCK_LOCATION,
|
||||
&sb_validator, ©, &inc);
|
||||
if (r)
|
||||
if (r) {
|
||||
dm_sm_dec_block(pmd->metadata_sm, THIN_SUPERBLOCK_LOCATION);
|
||||
return r;
|
||||
}
|
||||
|
||||
BUG_ON(!inc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user