From owner-freebsd-bugs Sun Aug 18 11:40:11 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92D2537B400 for ; Sun, 18 Aug 2002 11:40:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E23DA43E65 for ; Sun, 18 Aug 2002 11:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7IIe1JU030714 for ; Sun, 18 Aug 2002 11:40:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7IIe11K030713; Sun, 18 Aug 2002 11:40:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7879437B400 for ; Sun, 18 Aug 2002 11:30:37 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 387F443E6A for ; Sun, 18 Aug 2002 11:30:37 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g7IIUaOT005470 for ; Sun, 18 Aug 2002 11:30:36 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g7IIUaas005469; Sun, 18 Aug 2002 11:30:36 -0700 (PDT) Message-Id: <200208181830.g7IIUaas005469@www.freebsd.org> Date: Sun, 18 Aug 2002 11:30:36 -0700 (PDT) From: "George V. Neville-Neil" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/41765: UDP socket remains connected after error Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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