Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys Pull up following revision(s) (requested by maxv in t...
details: https://anonhg.NetBSD.org/src/rev/6b9dc4b743a6
branches: netbsd-7
changeset: 798750:6b9dc4b743a6
user: martin <martin%NetBSD.org@localhost>
date: Mon Dec 29 16:35:51 2014 +0000
description:
Pull up following revision(s) (requested by maxv in ticket #353):
sys/ufs/chfs/chfs_vfsops.c: revision 1.12
sys/compat/common/vfs_syscalls_30.c: revision 1.35
sys/compat/linux/common/linux_uselib.c: revision 1.31
sys/compat/linux/common/linux_uselib.c: revision 1.32
Resource leak.
Memory leaks.
Reject non-regular files.
diffstat:
sys/compat/common/vfs_syscalls_30.c | 10 +++++++---
sys/compat/linux/common/linux_uselib.c | 26 ++++++++++++++++----------
sys/ufs/chfs/chfs_vfsops.c | 7 +++++--
3 files changed, 28 insertions(+), 15 deletions(-)
diffs (125 lines):
diff -r d17489f100bd -r 6b9dc4b743a6 sys/compat/common/vfs_syscalls_30.c
--- a/sys/compat/common/vfs_syscalls_30.c Mon Dec 29 16:28:14 2014 +0000
+++ b/sys/compat/common/vfs_syscalls_30.c Mon Dec 29 16:35:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_30.c,v 1.33 2010/11/19 06:44:35 dholland Exp $ */
+/* $NetBSD: vfs_syscalls_30.c,v 1.33.34.1 2014/12/29 16:35:51 martin Exp $ */
/*-
* Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.33 2010/11/19 06:44:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.33.34.1 2014/12/29 16:35:51 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -356,9 +356,13 @@
}
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
error = namei(&nd);
- if (error)
+ if (error) {
+ pathbuf_destroy(pb);
return (error);
+ }
vp = nd.ni_vp;
+ pathbuf_destroy(pb);
+
sz = sizeof(struct compat_30_fhandle);
error = vfs_composefh(vp, (void *)&fh, &sz);
vput(vp);
diff -r d17489f100bd -r 6b9dc4b743a6 sys/compat/linux/common/linux_uselib.c
--- a/sys/compat/linux/common/linux_uselib.c Mon Dec 29 16:28:14 2014 +0000
+++ b/sys/compat/linux/common/linux_uselib.c Mon Dec 29 16:35:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $ */
+/* $NetBSD: linux_uselib.c,v 1.30.38.1 2014/12/29 16:35:51 martin Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.30 2009/08/28 01:39:03 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.30.38.1 2014/12/29 16:35:51 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -100,20 +100,26 @@
if (error != 0)
return error;
+ if (vp->v_type != VREG) {
+ error = EINVAL;
+ goto out;
+ }
+
if ((error = vn_rdwr(UIO_READ, vp, (void *) &hdr, LINUX_AOUT_HDR_SIZE,
0, UIO_SYSSPACE, IO_NODELOCKED, l->l_cred,
&rem, NULL))) {
- vrele(vp);
- return error;
+ goto out;
}
if (rem != 0) {
- vrele(vp);
- return ENOEXEC;
+ error = ENOEXEC;
+ goto out;
}
- if (LINUX_N_MACHTYPE(&hdr) != LINUX_MID_MACHINE)
- return ENOEXEC;
+ if (LINUX_N_MACHTYPE(&hdr) != LINUX_MID_MACHINE) {
+ error = ENOEXEC;
+ goto out;
+ }
magic = LINUX_N_MAGIC(&hdr);
taddr = hdr.a_entry & (~(PAGE_SIZE - 1));
@@ -123,7 +129,7 @@
error = vn_marktext(vp);
if (error)
- return (error);
+ goto out;
vcset.evs_cnt = 0;
vcset.evs_used = 0;
@@ -150,7 +156,7 @@
kill_vmcmds(&vcset);
+out:
vrele(vp);
-
return error;
}
diff -r d17489f100bd -r 6b9dc4b743a6 sys/ufs/chfs/chfs_vfsops.c
--- a/sys/ufs/chfs/chfs_vfsops.c Mon Dec 29 16:28:14 2014 +0000
+++ b/sys/ufs/chfs/chfs_vfsops.c Mon Dec 29 16:35:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chfs_vfsops.c,v 1.11 2014/04/16 18:55:19 maxv Exp $ */
+/* $NetBSD: chfs_vfsops.c,v 1.11.2.1 2014/12/29 16:35:51 martin Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@@ -152,9 +152,12 @@
}
/* Look up the name and verify that it's sane. */
NDINIT(&nd, LOOKUP, FOLLOW, pb);
- if ((err = namei(&nd)) != 0 )
+ if ((err = namei(&nd)) != 0 ) {
+ pathbuf_destroy(pb);
return (err);
+ }
devvp = nd.ni_vp;
+ pathbuf_destroy(pb);
/* Be sure this is a valid block device */
if (devvp->v_type != VBLK)
Home |
Main Index |
Thread Index |
Old Index