summaryrefslogtreecommitdiffstats
path: root/crypto/cast6_generic.c
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2020-09-01 08:25:44 +0200
committerMike Snitzer <snitzer@redhat.com>2020-09-02 19:38:40 +0200
commit3a653b205f29b3f9827a01a0c88bfbcb0d169494 (patch)
treef107efa83cce9414e535847930e5c7e68d989d0e /crypto/cast6_generic.c
parentdm thin metadata: Avoid returning cmd->bm wild pointer on error (diff)
downloadlinux-3a653b205f29b3f9827a01a0c88bfbcb0d169494.tar.xz
linux-3a653b205f29b3f9827a01a0c88bfbcb0d169494.zip
dm thin metadata: Fix use-after-free in dm_bm_set_read_only
The following error ocurred when testing disk online/offline: [ 301.798344] device-mapper: thin: 253:5: aborting current metadata transaction [ 301.848441] device-mapper: thin: 253:5: failed to abort metadata transaction [ 301.849206] Aborting journal on device dm-26-8. [ 301.850489] EXT4-fs error (device dm-26) in __ext4_new_inode:943: Journal has aborted [ 301.851095] EXT4-fs (dm-26): Delayed block allocation failed for inode 398742 at logical offset 181 with max blocks 19 with error 30 [ 301.854476] BUG: KASAN: use-after-free in dm_bm_set_read_only+0x3a/0x40 [dm_persistent_data] Reason is: metadata_operation_failed abort_transaction dm_pool_abort_metadata __create_persistent_data_objects r = __open_or_format_metadata if (r) --> If failed will free pmd->bm but pmd->bm not set NULL dm_block_manager_destroy(pmd->bm); set_pool_mode dm_pool_metadata_read_only(pool->pmd); dm_bm_set_read_only(pmd->bm); --> use-after-free Add checks to see if pmd->bm is NULL in dm_bm_set_read_only and dm_bm_set_read_write functions. If bm is NULL it means creating the bm failed and so dm_bm_is_read_only must return true. Signed-off-by: Ye Bin <yebin10@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'crypto/cast6_generic.c')
0 files changed, 0 insertions, 0 deletions