Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/kern Pull up following revision(s) (requested by maxv...



details:   https://anonhg.NetBSD.org/src/rev/3c876d4ebcf7
branches:  netbsd-7
changeset: 799558:3c876d4ebcf7
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Aug 08 15:45:47 2015 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #942):
        sys/kern/uipc_syscalls.c: revision 1.179
Memory leak. Triggerable from an unprivileged user via COMPAT_43.

diffstat:

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

diffs (36 lines):

diff -r 387a0201d1d2 -r 3c876d4ebcf7 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Sat Aug 08 15:43:00 2015 +0000
+++ b/sys/kern/uipc_syscalls.c  Sat Aug 08 15:45:47 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $  */
+/*     $NetBSD: uipc_syscalls.c,v 1.172.2.1 2015/08/08 15:45:47 martin 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.172 2014/08/09 05:33:00 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.172.2.1 2015/08/08 15:45:47 martin Exp $");
 
 #include "opt_pipe.h"
 
@@ -665,9 +665,16 @@
        struct socket   *so;
        file_t          *fp;
 
-       if ((error = fd_getsock1(s, &so, &fp)) != 0)
+       if ((error = fd_getsock1(s, &so, &fp)) != 0) {
+               /* We have to free msg_name and msg_control ourselves */
+               if (mp->msg_flags & MSG_NAMEMBUF)
+                       m_freem(mp->msg_name);
+               if (mp->msg_flags & MSG_CONTROLMBUF)
+                       m_freem(mp->msg_control);
                return error;
+       }
        error = do_sys_sendmsg_so(l, s, so, fp, mp, flags, retsize);
+       /* msg_name and msg_control freed */
        fd_putfile(s);
        return error;
 }



Home | Main Index | Thread Index | Old Index