[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] vchan-socket-proxy: Handle closing shared input/output_fd



commit 40b532fbdcb2095da7152a1d08d9f0288524c223
Author:     Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Wed Jun 10 23:29:36 2020 -0400
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Fri Jun 26 12:00:05 2020 +0000

    vchan-socket-proxy: Handle closing shared input/output_fd
    
    input_fd & output_fd may be the same FD.  In that case, mark both as -1
    when closing one.  That avoids a dangling FD reference.
    
    Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Release-acked-by: Paul Durrant <paul@xxxxxxx>
---
 tools/libvchan/vchan-socket-proxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c 
b/tools/libvchan/vchan-socket-proxy.c
index 3552783ec2..e1d959c6d1 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -349,6 +349,8 @@ int data_loop(struct vchan_proxy_state *state)
                     libxenvchan_wait(state->ctrl);
                 }
                 close(state->input_fd);
+                if (state->input_fd == state->output_fd)
+                    state->output_fd = -1;
                 state->input_fd = -1;
                 /* TODO: maybe signal the vchan client somehow? */
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.