Source-Changes-HG archive

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

[src/trunk]: src/sys/kern PR/47591: Michael Plass: If the unix socket is clos...



details:   https://anonhg.NetBSD.org/src/rev/46595c4598c3
branches:  trunk
changeset: 790426:46595c4598c3
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 08 00:29:24 2013 +0000

description:
PR/47591: Michael Plass: If the unix socket is closed before accept,
unp->unp_conn will be NULL in PRU_ACCEPT, as called from
sys_accept->so_accept. This will cause the usrreq to return with
no error, leaving the mbuf gotten from m_get() with an uninitialized
length, containing junk from a previous call. Initialize m_len to
be 0 to handle this case. This is yet another reason why Beverly's
idea of setting m_len = 0 in m_get() makes a lot of sense. Arguably
this could be an error, since the data we return now has 0 family
and length.

diffstat:

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

diffs (26 lines):

diff -r 7c5636de6303 -r 46595c4598c3 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Mon Oct 07 19:53:05 2013 +0000
+++ b/sys/kern/uipc_syscalls.c  Tue Oct 08 00:29:24 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.162 2013/08/29 17:49:21 rmind Exp $        */
+/*     $NetBSD: uipc_syscalls.c,v 1.163 2013/10/08 00:29:24 christos Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.162 2013/08/29 17:49:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.163 2013/10/08 00:29:24 christos Exp $");
 
 #include "opt_pipe.h"
 
@@ -184,6 +184,7 @@
                return (error);
        }
        nam = m_get(M_WAIT, MT_SONAME);
+       nam->m_len = 0;
        *new_sock = fd;
        so = fp->f_data;
        solock(so);



Home | Main Index | Thread Index | Old Index