[v2,12/30] files: Assign fdesc to fle in collect_fd() earlier

Submitted by Kirill Tkhai on June 7, 2017, 11:27 a.m.

Details

Message ID 149683487569.4663.13519503405640538523.stgit@localhost.localdomain
State Accepted
Series "Support sockets leaked to child user_ns task"
Headers show

Commit Message

Kirill Tkhai June 7, 2017, 11:27 a.m.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/files.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/files.c b/criu/files.c
index bbf3edae8..ce52ebd86 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -723,6 +723,7 @@  int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
 		pr_err("No file for fd %d id %#x\n", e->fd, e->id);
 		return -1;
 	}
+	new_le->desc = fdesc;
 
 	list_for_each_entry(le, &fdesc->fd_info_head, desc_list)
 		if (pid_rst_prio(new_le->pid, le->pid))
@@ -731,7 +732,6 @@  int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
 	collect_task_fd(new_le, rst_info);
 
 	list_add_tail(&new_le->desc_list, &le->desc_list);
-	new_le->desc = fdesc;
 
 	return 0;
 }