summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-07-26 20:24:48 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-07-26 20:24:48 +0000
commitfd15098c509fbfc3714ad60c73759c36edae6850 (patch)
treec75a0d925f9bd4786574b997565a8b7c115d60cd /sys/kern
parentc0e67202ad542df115ad7129df5da4508c00a92c (diff)
Back out changes to symlink and mknod that were not well tested.
A simple mknod at causes a kernel panic (uvm_fault).
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c11
-rw-r--r--sys/kern/vnode_if.c4
-rw-r--r--sys/kern/vnode_if.src14
3 files changed, 13 insertions, 16 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index a8db38f7ece..2e1cf5f8103 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.79 2001/07/26 02:10:41 assar Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.80 2001/07/26 20:24:47 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1249,8 +1249,6 @@ sys_mknod(p, v, retval)
} else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
- if (error == 0)
- vput(nd.ni_vp);
}
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1301,10 +1299,7 @@ sys_mkfifo(p, v, retval)
vattr.va_type = VFIFO;
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
- if (error == 0)
- vput(nd.ni_vp);
- return (error);
+ return (VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr));
#endif /* FIFO */
}
@@ -1398,8 +1393,6 @@ sys_symlink(p, v, retval)
vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
- if (error == 0)
- vput(nd.ni_vp);
out:
FREE(path, M_NAMEI);
return (error);
diff --git a/sys/kern/vnode_if.c b/sys/kern/vnode_if.c
index f5f698b6c13..1f30d85c507 100644
--- a/sys/kern/vnode_if.c
+++ b/sys/kern/vnode_if.c
@@ -154,7 +154,7 @@ int vop_mknod_vp_offsets[] = {
struct vnodeop_desc vop_mknod_desc = {
0,
"vop_mknod",
- 0 | VDESC_VP0_WILLRELE,
+ 0 | VDESC_VP0_WILLRELE | VDESC_VPP_WILLRELE,
vop_mknod_vp_offsets,
VOPARG_OFFSETOF(struct vop_mknod_args, a_vpp),
VDESC_NO_OFFSET,
@@ -797,7 +797,7 @@ int vop_symlink_vp_offsets[] = {
struct vnodeop_desc vop_symlink_desc = {
0,
"vop_symlink",
- 0 | VDESC_VP0_WILLRELE,
+ 0 | VDESC_VP0_WILLRELE | VDESC_VPP_WILLRELE,
vop_symlink_vp_offsets,
VOPARG_OFFSETOF(struct vop_symlink_args, a_vpp),
VDESC_NO_OFFSET,
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index e75c931d1a8..fdf8e6e4015 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -1,4 +1,4 @@
-# $OpenBSD: vnode_if.src,v 1.12 2001/07/26 02:10:41 assar Exp $
+# $OpenBSD: vnode_if.src,v 1.13 2001/07/26 20:24:47 millert Exp $
# $NetBSD: vnode_if.src,v 1.10 1996/05/11 18:26:27 mycroft Exp $
#
# Copyright (c) 1992, 1993
@@ -102,12 +102,12 @@ vop_create {
#
#% mknod dvp L U U
-#% mknod vpp - L -
+#% mknod vpp - X -
#
vop_mknod {
IN SHOULDBELOCKED WILLRELE struct vnode *dvp;
- OUT struct vnode **vpp;
+ OUT WILLRELE struct vnode **vpp;
IN struct componentname *cnp;
IN struct vattr *vap;
};
@@ -314,12 +314,16 @@ vop_rmdir {
#
#% symlink dvp L U U
-#% symlink vpp - L -
+#% symlink vpp - U -
+#
+# XXX - note that the return vnode has already been VRELE'ed
+# by the filesystem layer. To use it you must use vget,
+# possibly with a further namei.
#
vop_symlink {
IN SHOULDBELOCKED WILLRELE struct vnode *dvp;
- OUT struct vnode **vpp;
+ OUT WILLRELE struct vnode **vpp;
IN struct componentname *cnp;
IN struct vattr *vap;
IN char *target;