5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit dfb95816cf6f2f2660af2ec64c65dc204c60b5e7 upstream. If __set_snapshot_details fails, the variable td is leaked - this prevents any other snapshot with the same id from being created. Fix this by removing it from the list and freeing it. Signed-off-by: Mikulas Patocka Assisted-by: Claude:claude-opus-5 Cc: stable@vger.kernel.org Fixes: 991d9fa02da0 ("dm: add thin provisioning target") Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-thin-metadata.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -1203,10 +1203,13 @@ static int __create_snap(struct dm_pool_ __close_device(td); if (r) - goto bad; + goto bad2; return 0; +bad2: + list_del(&td->list); + kfree(td); bad: dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root); dm_btree_remove(&pmd->details_info, pmd->details_root,