Module Name:    src
Committed By:   christos
Date:           Sun Jun  8 02:52:50 UTC 2014

Modified Files:
        src/sys/kern: uipc_usrreq.c

Log Message:
Handle race where the server closed the socket between us 'connecting' and
sending data.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 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.152 src/sys/kern/uipc_usrreq.c:1.153
--- src/sys/kern/uipc_usrreq.c:1.152	Sun May 18 22:51:24 2014
+++ src/sys/kern/uipc_usrreq.c	Sat Jun  7 22:52:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.152 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.153 2014/06/08 02:52:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.152 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.153 2014/06/08 02:52:50 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -303,6 +303,9 @@ unp_output(struct mbuf *m, struct mbuf *
 	struct socket *so2;
 	const struct sockaddr_un *sun;
 
+	/* XXX: server side closed the socket */
+	if (unp->unp_conn == NULL)
+		return ECONNREFUSED;
 	so2 = unp->unp_conn->unp_socket;
 
 	KASSERT(solocked(so2));

Reply via email to