[PATCH] dm_early_create: fix freeing used table on dm_resume failure

Mikulas Patocka <[email protected]> Thu, 9 Jul 2026 21:29:11 +0200 (CEST)
Newsgroups dev.linux.lists.dm-devel
Message-ID <[email protected]>
If dm_resume fails, the kernel attempts to free table with
dm_table_destroy, but the table was already instantiated with
dm_swap_table. This commit skips the call to dm_table_destroy in this
case.

Signed-off-by: Mikulas Patocka <[email protected]>
Assisted-by: Claude:claude-opus-4.6
Fixes: 6bbc923dfcf5 ("dm: add support to directly boot to a mapped device")
Cc: [email protected]

---
 drivers/md/dm-ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c	2026-05-25 11:06:07.000000000 +0200
+++ linux-2.6/drivers/md/dm-ioctl.c	2026-06-23 12:59:17.000000000 +0200
@@ -2387,7 +2387,7 @@ int __init dm_early_create(struct dm_ioc
 	/* resume device */
 	r = dm_resume(md);
 	if (r)
-		goto err_destroy_table;
+		goto err_hash_remove;
 
 	DMINFO("%s (%s) is ready", md->disk->disk_name, dmi->name);
 	dm_put(md);