summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2004-09-16 10:37:42 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2004-09-16 10:37:42 +0000
commitc40004d58e6620664f294a62bc7dec6980278da2 (patch)
tree284b66ff64390cbc591afdb4c3d8997e181bd2f0 /sys
parentf32494e11253fd6e1184523d65a59faa99a55c09 (diff)
check for VBAD vnodes on getvnode(). ok andreas@, tedu@ and marius@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_syscalls.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7be2a337060..e142295b8ec 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.117 2004/08/05 04:46:26 tedu Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.118 2004/09/16 10:37:41 pedro Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -2647,11 +2647,18 @@ getvnode(fdp, fd, fpp)
int fd;
{
struct file *fp;
+ struct vnode *vp;
if ((fp = fd_getfile(fdp, fd)) == NULL)
return (EBADF);
+
if (fp->f_type != DTYPE_VNODE)
return (EINVAL);
+
+ vp = (struct vnode *)fp->f_data;
+ if (vp->v_type == VBAD)
+ return (EBADF);
+
FREF(fp);
*fpp = fp;