linux_dsm_epyc7002/drivers/md/persistent-data
Mike Snitzer 62662303e7 dm persistent data: handle space map checker creation failure
If CONFIG_DM_DEBUG_SPACE_MAPS is enabled and dm_sm_checker_create()
fails, dm_tm_create_internal() would still return success even though it
cleaned up all resources it was supposed to have created.  This will
lead to a kernel crash:

general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
...
RIP: 0010:[<ffffffff81593659>]  [<ffffffff81593659>] dm_bufio_get_block_size+0x9/0x20
Call Trace:
  [<ffffffff81599bae>] dm_bm_block_size+0xe/0x10
  [<ffffffff8159b8b8>] sm_ll_init+0x78/0xd0
  [<ffffffff8159c1a6>] sm_ll_new_disk+0x16/0xa0
  [<ffffffff8159c98e>] dm_sm_disk_create+0xfe/0x160
  [<ffffffff815abf6e>] dm_pool_metadata_open+0x16e/0x6a0
  [<ffffffff815aa010>] pool_ctr+0x3f0/0x900
  [<ffffffff8158d565>] dm_table_add_target+0x195/0x450
  [<ffffffff815904c4>] table_load+0xe4/0x330
  [<ffffffff815917ea>] ctl_ioctl+0x15a/0x2c0
  [<ffffffff81591963>] dm_ctl_ioctl+0x13/0x20
  [<ffffffff8116a4f8>] do_vfs_ioctl+0x98/0x560
  [<ffffffff8116aa51>] sys_ioctl+0x91/0xa0
  [<ffffffff81869f52>] system_call_fastpath+0x16/0x1b

Fix the space map checker code to return an appropriate ERR_PTR and have
dm_sm_disk_create() and dm_tm_create_internal() check for it with
IS_ERR.

Reported-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2012-07-03 12:55:35 +01:00
..
dm-block-manager.c dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-block-manager.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-btree-internal.h dm persistent data: remove redundant value_size arg from value_ptr 2012-03-28 18:41:25 +01:00
dm-btree-remove.c dm persistent data: remove redundant value_size arg from value_ptr 2012-03-28 18:41:25 +01:00
dm-btree-spine.c dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-btree.c dm persistent data: remove redundant value_size arg from value_ptr 2012-03-28 18:41:25 +01:00
dm-btree.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-persistent-data-internal.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-checker.c dm persistent data: handle space map checker creation failure 2012-07-03 12:55:35 +01:00
dm-space-map-checker.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-common.c dm persistent data: remove space map ref_count entries if redundant 2012-03-28 18:41:27 +01:00
dm-space-map-common.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-disk.c dm persistent data: handle space map checker creation failure 2012-07-03 12:55:35 +01:00
dm-space-map-disk.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-metadata.c dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map-metadata.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-space-map.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
dm-transaction-manager.c dm persistent data: handle space map checker creation failure 2012-07-03 12:55:35 +01:00
dm-transaction-manager.h dm: add persistent data library 2011-10-31 20:19:11 +00:00
Kconfig dm: add persistent data library 2011-10-31 20:19:11 +00:00
Makefile dm: add persistent data library 2011-10-31 20:19:11 +00:00