[PATCH 1/1] don't call pre_restore_task twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pre_restore_task is being called both before and inside
restore_task, causing a memory leak at
current->checkpoint_data.

Only call it once, outside restore_task.

This fixes a memory leak spotted by Dan Smith, and the
actual bug was deduced by Matt Helsley.

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
Reported-by: Dan Smith <danms@xxxxxxxxxx>
Cc: Dan Smith <danms@xxxxxxxxxx>
Cc: Matt Helsley <matthltc@xxxxxxxxxx>

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
---
 checkpoint/process.c |    4 ----
 checkpoint/restart.c |    1 +
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/checkpoint/process.c b/checkpoint/process.c
index 424f688..c51e036 100644
--- a/checkpoint/process.c
+++ b/checkpoint/process.c
@@ -864,10 +864,6 @@ int restore_task(struct ckpt_ctx *ctx)
 {
 	int ret;
 
-	ret = pre_restore_task(ctx);
-	if (ret < 0)
-		goto out;
-
 	ret = restore_task_struct(ctx);
 	ckpt_debug("task %d\n", ret);
 	if (ret < 0)
diff --git a/checkpoint/restart.c b/checkpoint/restart.c
index 3a58a76..fc94374 100644
--- a/checkpoint/restart.c
+++ b/checkpoint/restart.c
@@ -967,6 +967,7 @@ static int do_restore_task(void)
 	 */
 	if (zombie) {
 		restore_debug_exit(ctx);
+		post_restore_task(ctx);
 		ckpt_ctx_put(ctx);
 		do_exit(current->exit_code);
 	}
-- 
1.5.4.3

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux