mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
libxl: Fix carefd lock leak in save callout
If libxl_pipe fails we leave the carefd locked, which translates to the atfork lock remaining held. This would probably cause the process to deadlock shortly afterwards. Of course libxl_pipe is very unlikely to fail unless things are already going very badly. This bug has not been observed anywhere as far as we are aware. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: George Dunlap <george.dunlap@eu.citrix.com> (cherry picked from commit7eb73add5d) (cherry picked from commit4bb3a17449)
This commit is contained in:
1 parent
d0c5e6a5e5
commit
de474025e7
1 file changed
+5
-1
@@ -185,7 +185,11 @@ static void run_helper(libxl__egc *egc, libxl__save_helper_state *shs,
|
||||
for (childfd=0; childfd<2; childfd++) {
|
||||
/* Setting up the pipe for the child's fd childfd */
|
||||
int fds[2];
|
||||
if (libxl_pipe(CTX,fds)) { rc = ERROR_FAIL; goto out; }
|
||||
if (libxl_pipe(CTX,fds)) {
|
||||
rc = ERROR_FAIL;
|
||||
libxl__carefd_unlock();
|
||||
goto out;
|
||||
}
|
||||
int childs_end = childfd==0 ? 0 /*read*/ : 1 /*write*/;
|
||||
int our_end = childfd==0 ? 1 /*write*/ : 0 /*read*/;
|
||||
childs_pipes[childfd] = libxl__carefd_record(CTX, fds[childs_end]);
|
||||
|
||||