Commit 851a8a7f authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds
Browse files

dm: fix memory leak in dm_create_persistent() when starting metadata update thread fails

If, in dm_create_persistent(), the call to create_singlethread_workqueue()
fails then we'll return without freeing the memory allocated to 'ps', thus
leaking sizeof(struct pstore) bytes.  This patch fixes the leak.

Signed-off-by: default avatarJesper Juhl <>
Acked-by: default avatarAlasdair G Kergon <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent cb32da04
......@@ -623,6 +623,7 @@ int dm_create_persistent(struct exception_store *store)
ps->metadata_wq = create_singlethread_workqueue("ksnaphd");
if (!ps->metadata_wq) {
DMERR("couldn't start header metadata update thread");
return -ENOMEM;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment