[PATCH] Possible fd leak with signal pipe

Ian Wienand ianw at vmware.com
Sat May 10 02:00:13 WST 2008


Hi,

We had a problem with a pipe fd leaking into children; I tracked it
down to the pipe() call setting up signal_pipe.  I'm pretty sure that
should be counted in the maxfd count?

Thanks,

-i

Index: dropbear-0.51/common-session.c
===================================================================
--- dropbear-0.51.orig/common-session.c	2008-05-09 10:54:33.000000000 -0700
+++ dropbear-0.51/common-session.c	2008-05-09 10:55:53.000000000 -0700
@@ -69,7 +69,10 @@
 	}
 	setnonblocking(ses.signal_pipe[0]);
 	setnonblocking(ses.signal_pipe[1]);
-	
+
+	ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[0]);
+	ses.maxfd = MAX(ses.maxfd, ses.signal_pipe[1]);
+
 	kexfirstinitialise(); /* initialise the kex state */

 	ses.writepayload = buf_new(TRANS_MAX_PAYLOAD_LEN);



More information about the Dropbear mailing list