[CRIU] [PATCH] mount: don't close a namespace descriptor two times

Andrey Vagin avagin at openvz.org
Mon Sep 2 16:48:27 EDT 2013


CID null (#1 of 1): Double close (USE_AFTER_FREE)
10. double_close: Calling "restore_ns(int, struct ns_desc *)" closes
handle "ns_old" which has already been closed.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 mount.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index 9abbe95..44e33bd 100644
--- a/mount.c
+++ b/mount.c
@@ -455,8 +455,10 @@ static DIR *open_mountpoint(struct mount_info *pm)
 	if (fd < 0)
 		goto out;
 
-	if (restore_ns(ns_old, &mnt_ns_desc))
+	if (restore_ns(ns_old, &mnt_ns_desc)) {
+		ns_old = -1;
 		goto out;
+	}
 
 	return __open_mountpoint(pm, fd);;
 out:
-- 
1.8.3.1



More information about the CRIU mailing list