Module Name:    src
Committed By:   jdc
Date:           Tue Apr 14 09:02:52 UTC 2009

Modified Files:
        src/sys/kern [netbsd-3-1]: uipc_usrreq.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.2.2.3 -r1.80.2.2.2.4 src/sys/kern/uipc_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.80.2.2.2.3 src/sys/kern/uipc_usrreq.c:1.80.2.2.2.4
--- src/sys/kern/uipc_usrreq.c:1.80.2.2.2.3	Tue Apr 14 08:50:51 2009
+++ src/sys/kern/uipc_usrreq.c	Tue Apr 14 09:02:52 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.80.2.2.2.3 2009/04/14 08:50:51 jdc Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.80.2.2.2.4 2009/04/14 09:02:52 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.2.2.3 2009/04/14 08:50:51 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.2.2.4 2009/04/14 09:02:52 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)

Reply via email to