The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2881

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Previously this set `ctx->ns_fd[*]` to `-EBADF` until commit
fd2a88b190eb ("attach: cleanup macros lxc_proc_close_ns_fd",
but there are some code paths where we call this before
later calling `lxc_proc_put_context_info` which would call
this function again with the file descriptors still
unchanged.

Note: Haven't run into an actual issue, just noticed this while
going through my unread notifications...

From 5f9facdac9fed59f5e4b52a35bf550a417ae7e7e Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <[email protected]>
Date: Mon, 25 Feb 2019 17:05:24 +0100
Subject: [PATCH] attach: use move_fd in lxc_proc_close_ns_fd

Previously this set `ctx->ns_fd[*]` to `-EBADF` until commit
fd2a88b190eb ("attach: cleanup macros lxc_proc_close_ns_fd",
but there are some code paths where we call this before
later calling `lxc_proc_put_context_info` which would call
this function again with the file descriptors still
unchanged.

Signed-off-by: Wolfgang Bumiller <[email protected]>
---
 src/lxc/attach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index e00584178b..288458230f 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -126,7 +126,7 @@ static struct lxc_proc_context_info 
*lxc_proc_get_context_info(pid_t pid)
 static inline void lxc_proc_close_ns_fd(struct lxc_proc_context_info *ctx)
 {
        for (int i = 0; i < LXC_NS_MAX; i++) {
-               __do_close_prot_errno int fd = ctx->ns_fd[i];
+               __do_close_prot_errno int fd = move_fd(ctx->ns_fd[i]);
        }
 }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to