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 Apply patch (requested by mlelstv in ticket #2...



details:   https://anonhg.NetBSD.org/src/rev/87498d811c9c
branches:  netbsd-3-0
changeset: 579528:87498d811c9c
user:      jdc <jdc%NetBSD.org@localhost>
date:      Tue Apr 14 09:02:40 2009 +0000

description:
Apply patch (requested by mlelstv in ticket #2005):
Fix a problem with a failure path (see PR kern/38391).

diffstat:

 sys/kern/uipc_usrreq.c |  36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diffs (65 lines):

diff -r 4d155bb839b3 -r 87498d811c9c sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Tue Apr 14 08:50:41 2009 +0000
+++ b/sys/kern/uipc_usrreq.c    Tue Apr 14 09:02:40 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_usrreq.c,v 1.80.2.1.2.3 2009/04/14 08:50:41 jdc Exp $     */
+/*     $NetBSD: uipc_usrreq.c,v 1.80.2.1.2.4 2009/04/14 09:02:40 jdc 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.2.3 2009/04/14 08:50:41 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.1.2.4 2009/04/14 09:02:40 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -305,30 +305,30 @@
                 * has the side-effect of preventing a caller from
                 * forging SCM_CREDS.
                 */
-               if (control && (error = unp_internalize(control, p))) {
-                       goto die;
+               if (control) {
+                       if ((error = unp_internalize(control, p)) != 0) {
+                               m_freem(control);
+                               m_freem(m);
+                               break;
+                       }
                }
                switch (so->so_type) {
 
                case SOCK_DGRAM: {
                        if (nam) {
-                               if ((so->so_state & SS_ISCONNECTED) != 0) {
+                               if ((so->so_state & SS_ISCONNECTED) != 0)
                                        error = EISCONN;
-                                       goto die;
-                               }
-                               error = unp_connect(so, nam, p);
-                               if (error) {
-                               die:
-                                       unp_dispose(control);
-                                       m_freem(control);
-                                       m_freem(m);
-                                       break;
-                               }
+                               else
+                                       error = unp_connect(so, nam, p);
                        } else {
-                               if ((so->so_state & SS_ISCONNECTED) == 0) {
+                               if ((so->so_state & SS_ISCONNECTED) == 0)
                                        error = ENOTCONN;
-                                       goto die;
-                               }
+                       }
+                       if (error) {
+                               unp_dispose(control);
+                               m_freem(control);
+                               m_freem(m);
+                               break;
                        }
                        error = unp_output(m, control, unp, p);
                        if (nam)



Home | Main Index | Thread Index | Old Index