[CRIU] [PATCH 3/3] tun: Check that net ns of tun device is dumped

Kirill Tkhai ktkhai at virtuozzo.com
Mon Feb 19 15:16:20 MSK 2018


Similar to socket logic, abort the dump,
if tun is not related to any net ns, seen
before.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/tun.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/criu/tun.c b/criu/tun.c
index e1d247409..d5ed65b76 100644
--- a/criu/tun.c
+++ b/criu/tun.c
@@ -293,6 +293,13 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
 		return -1;
 	}
 
+	if (kdat.tun_ns) {
+		if (!get_socket_ns(lfd)) {
+			pr_err("No net_ns for tun device\n");
+			return -1;
+		}
+	}
+
 	if (dump_one_reg_file(lfd, id, p))
 		return -1;
 



More information about the CRIU mailing list