Commit 33c58d94 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

net: Fix namespace fd leak in get_socket_ns()

We open ns_fd via ioctl(SIOCGSKNS), but never close. Fix that.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent a58e1f6f
......@@ -2701,8 +2701,10 @@ struct ns_id *get_socket_ns(int lfd)
}
if (fstat(ns_fd, &st)) {
pr_perror("Unable to stat a network namespace");
close(ns_fd);
return NULL;
}
close(ns_fd);
ns = lookup_ns_by_kid(st.st_ino, &net_ns_desc);
if (ns == NULL) {
......
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