diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2004-09-16 10:37:42 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2004-09-16 10:37:42 +0000 |
commit | c40004d58e6620664f294a62bc7dec6980278da2 (patch) | |
tree | 284b66ff64390cbc591afdb4c3d8997e181bd2f0 /sys | |
parent | f32494e11253fd6e1184523d65a59faa99a55c09 (diff) |
check for VBAD vnodes on getvnode(). ok andreas@, tedu@ and marius@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 9 |
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; |