From 8d5f9131fccc3bb06e4c59f2f28cf8b5d218cd17 Mon Sep 17 00:00:00 2001 From: Don Lewis Date: Thu, 19 Jun 2003 03:55:01 +0000 Subject: [PATCH] VOP_GETVOBJECT() wants to be called with the vnode lock held. --- sys/kern/uipc_syscalls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 98be6d3006f..d6b694743f1 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1775,10 +1775,13 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) */ if ((error = fgetvp_read(td, uap->fd, &vp)) != 0) goto done; + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (vp->v_type != VREG || VOP_GETVOBJECT(vp, &obj) != 0) { error = EINVAL; + VOP_UNLOCK(vp, 0, td); goto done; } + VOP_UNLOCK(vp, 0, td); if ((error = fgetsock(td, uap->s, &so, NULL)) != 0) goto done; if (so->so_type != SOCK_STREAM) {