Source-Changes-HG archive

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

[src/netbsd-6-1]: src/sys/netinet Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/13fb0cf78d43
branches:  netbsd-6-1
changeset: 775875:13fb0cf78d43
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Oct 20 13:29:44 2013 +0000

description:
Pull up following revision(s) (requested by spz in ticket #967):
        sys/netinet/tcp_usrreq.c: revision 1.168
PR/48098: Brian Marcotte: Avoid kernel assertion for embryonic sockets that
don't have credentials yet.
XXX: pullup-6

diffstat:

 sys/netinet/tcp_usrreq.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (47 lines):

diff -r ff557a3e8328 -r 13fb0cf78d43 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Sun Oct 20 13:18:50 2013 +0000
+++ b/sys/netinet/tcp_usrreq.c  Sun Oct 20 13:29:44 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.162.2.1 2012/03/17 19:51:45 bouyer Exp $      */
+/*     $NetBSD: tcp_usrreq.c,v 1.162.2.1.6.1 2013/10/20 13:29:44 bouyer Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -95,7 +95,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.162.2.1 2012/03/17 19:51:45 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.162.2.1.6.1 2013/10/20 13:29:44 bouyer Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1168,18 +1168,20 @@
 static inline int
 copyout_uid(struct socket *sockp, void *oldp, size_t *oldlenp)
 {
-       size_t sz;
-       int error;
-       uid_t uid;
+       if (oldp) {
+               size_t sz;
+               uid_t uid;
+               int error;
 
-       uid = kauth_cred_geteuid(sockp->so_cred);
-       if (oldp) {
+               if (sockp->so_cred == NULL)
+                       return EPERM;
+
+               uid = kauth_cred_geteuid(sockp->so_cred);
                sz = MIN(sizeof(uid), *oldlenp);
-               error = copyout(&uid, oldp, sz);
-               if (error)
+               if ((error = copyout(&uid, oldp, sz)) != 0)
                        return error;
        }
-       *oldlenp = sizeof(uid);
+       *oldlenp = sizeof(uid_t);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index