[PATCH] libnetworking: Disconnect after mbuf shortage

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Nov 2 15:11:59 UTC 2012


The missing disconnect left the socket in an unusable state.  Each send
request resulted in an EISCONN error.
---
 cpukit/libnetworking/netinet/udp_usrreq.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cpukit/libnetworking/netinet/udp_usrreq.c b/cpukit/libnetworking/netinet/udp_usrreq.c
index 8b56c28..e34f6c4 100644
--- a/cpukit/libnetworking/netinet/udp_usrreq.c
+++ b/cpukit/libnetworking/netinet/udp_usrreq.c
@@ -399,8 +399,11 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
 	M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);
 	if (m == 0) {
 		error = ENOBUFS;
-		if (addr)
+		if (addr) {
+			in_pcbdisconnect(inp);
+			inp->inp_laddr = laddr;
 			splx(s);
+		}
 		goto release;
 	}
 
-- 
1.7.7




More information about the devel mailing list