Commit 62d77801 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

tun: Check that net ns of tun device is dumped

Similar to socket logic, abort the dump,
if tun is not related to any net ns, seen
before.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
parent fe7d8a92
......@@ -290,6 +290,7 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
struct cr_img *img;
FileEntry fe = FILE_ENTRY__INIT;
TunfileEntry tfe = TUNFILE_ENTRY__INIT;
struct ns_id *ns;
struct ifreq ifr;
if (!(root_ns_mask & CLONE_NEWNET)) {
......@@ -297,6 +298,14 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
return -1;
}
if (kdat.tun_ns) {
ns = get_socket_ns(lfd);
if (!ns) {
pr_err("No net_ns for tun device\n");
return -1;
}
}
if (dump_one_reg_file(lfd, id, p))
return -1;
......
Markdown is supported
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