dm ioctl: fix hang in early create error condition
authorHelen Koike <helen.koike@collabora.com>
Wed, 15 May 2019 16:50:54 +0000 (13:50 -0300)
committerMike Snitzer <snitzer@redhat.com>
Thu, 16 May 2019 13:52:06 +0000 (09:52 -0400)
commit0f41fcf78849c902ddca564f99a8e23ccfc80333
treee56d03d13d08cb5b901e057dc008099e77e2809c
parent05d6909ea9d62bb357846177a84842e09fc15914
dm ioctl: fix hang in early create error condition

The dm_early_create() function (which deals with "dm-mod.create=" kernel
command line option) calls dm_hash_insert() who gets an extra reference
to the md object.

In case of failure, this reference wasn't being released, causing
dm_destroy() to hang, thus hanging the whole boot process.

Fix this by calling __hash_remove() in the error path.

Fixes: 6bbc923dfcf57d ("dm: add support to directly boot to a mapped device")
Cc: stable@vger.kernel.org
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ioctl.c