Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3-0]: src/sys/kern Pull up following revision(s) (requested by ma...



details:   https://anonhg.NetBSD.org/src/rev/8311f6b94e23
branches:  netbsd-3-0
changeset: 579441:8311f6b94e23
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Aug 26 20:27:40 2007 +0000

description:
Pull up following revision(s) (requested by martin in ticket #1820):
        sys/kern/uipc_usrreq.c: revision 1.98
PR kern/32842:
do not leak file descriptors when sending a datagram with SCM_RIGHTS
fails. Patch from Gary Thorpe, based on changes in FreeBSD and work
from Christian Biere.

diffstat:

 sys/kern/uipc_usrreq.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 38874789c976 -r 8311f6b94e23 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Sun Aug 26 20:04:55 2007 +0000
+++ b/sys/kern/uipc_usrreq.c    Sun Aug 26 20:27:40 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_usrreq.c,v 1.80.2.1 2005/07/11 11:40:12 tron Exp $        */
+/*     $NetBSD: uipc_usrreq.c,v 1.80.2.1.2.1 2007/08/26 20:27:40 bouyer Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.1 2005/07/11 11:40:12 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.1.2.1 2007/08/26 20:27:40 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -150,6 +150,7 @@
                control = unp_addsockcred(p, control);
        if (sbappendaddr(&so2->so_rcv, (struct sockaddr *)sun, m,
            control) == 0) {
+               unp_dispose(control);
                m_freem(control);
                m_freem(m);
                so2->so_rcv.sb_overflowed++;
@@ -318,6 +319,7 @@
                                error = unp_connect(so, nam, p);
                                if (error) {
                                die:
+                                       unp_dispose(control);
                                        m_freem(control);
                                        m_freem(m);
                                        break;
@@ -354,8 +356,10 @@
                         * Wake up readers.
                         */
                        if (control) {
-                               if (sbappendcontrol(rcv, m, control) == 0)
+                               if (sbappendcontrol(rcv, m, control) == 0) {
+                                       unp_dispose(control);
                                        m_freem(control);
+                               }
                        } else
                                sbappend(rcv, m);
                        snd->sb_mbmax -=



Home | Main Index | Thread Index | Old Index