Module Name: src Committed By: maxv Date: Mon Oct 31 15:05:05 UTC 2016
Modified Files: src/sys/kern: uipc_usrreq.c Log Message: Memory leak, found by Mootja. It is easily triggerable from userland. To generate a diff of this commit: cvs rdiff -u -r1.180 -r1.181 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.180 src/sys/kern/uipc_usrreq.c:1.181 --- src/sys/kern/uipc_usrreq.c:1.180 Wed Apr 6 19:45:45 2016 +++ src/sys/kern/uipc_usrreq.c Mon Oct 31 15:05:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.180 2016/04/06 19:45:45 roy Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.181 2016/10/31 15:05:05 maxv 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.180 2016/04/06 19:45:45 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.181 2016/10/31 15:05:05 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1151,11 +1151,11 @@ unp_connect(struct socket *so, struct so goto bad2; } vp = nd.ni_vp; + pathbuf_destroy(pb); if (vp->v_type != VSOCK) { error = ENOTSOCK; goto bad; } - pathbuf_destroy(pb); if ((error = VOP_ACCESS(vp, VWRITE, l->l_cred)) != 0) goto bad; /* Acquire v_interlock to protect against unp_detach(). */