Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Handle race where the server closed the socket betw...



details:   https://anonhg.NetBSD.org/src/rev/8edfea4f8296
branches:  trunk
changeset: 796532:8edfea4f8296
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 08 02:52:50 2014 +0000

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

diffstat:

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

diffs (28 lines):

diff -r 5052cc0dad3e -r 8edfea4f8296 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Sun Jun 08 02:44:15 2014 +0000
+++ b/sys/kern/uipc_usrreq.c    Sun Jun 08 02:52:50 2014 +0000
@@ -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 @@
        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));



Home | Main Index | Thread Index | Old Index