Date: Sun, 18 Aug 2002 11:30:36 -0700 (PDT) From: "George V. Neville-Neil" <gnn@neville-neil.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/41765: UDP socket remains connected after error Message-ID: <200208181830.g7IIUaas005469@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 41765
>Category: kern
>Synopsis: UDP socket remains connected after error
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 18 11:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: George V. Neville-Neil
>Release: 4.6-STABLE and -CURRENT
>Organization:
Neville-Neil Consulting
>Environment:
FreeBSD jchurch.neville-neil.com 4.6-STABLE FreeBSD 4.6-STABLE #4: Sat Jul 13 18:54:53 PDT 2002 root@jchurch.neville-neil.com:/usr/local/src-STABLE/src/sys/compile/JCHURCH i386
>Description:
In udp_usrreq.c:udp_output() a UDP socket is temporarily connected to transmit the packet. If an out of mbufs error occurs the socket is never disconnected.
>How-To-Repeat:
Write a lot of UDP packets while using up a lot of mbufs (this occurs in a piece
of propietary software written where I'm working).
>Fix:
This patch from Jinmei Tatuya (against 4.6 but a similar solution is
necessary in -CURRENT):
--- udp_usrreq.c.orig Tue Aug 13 13:49:50 2002
+++ udp_usrreq.c Tue Aug 13 13:52:34 2002
@@ -704,9 +704,7 @@
M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);
if (m == 0) {
error = ENOBUFS;
- if (addr)
- splx(s);
- goto release;
+ goto disconnect;
}
/*
@@ -741,7 +739,7 @@
#ifdef IPSEC
if (ipsec_setsocket(m, inp->inp_socket) != 0) {
error = ENOBUFS;
- goto release;
+ goto disconnect;
}
#endif /*IPSEC*/
error = ip_output(m, inp->inp_options, &inp->inp_route,
@@ -754,6 +752,13 @@
splx(s);
}
return (error);
+
+disconnect:
+ if (addr) {
+ in_pcbdisconnect(inp);
+ inp->inp_laddr = laddr; /* XXX rehash? */
+ splx(s);
+ }
release:
m_freem(m);
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208181830.g7IIUaas005469>
