VOP_GETATTR() needs a shared lock at least.

This commit is contained in:
hannken 2011-10-16 12:26:16 +00:00
parent b338bf9392
commit 961731268e
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vnops.c,v 1.113 2011/06/12 03:35:58 rmind Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.114 2011/10/16 12:26:16 hannken Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.113 2011/06/12 03:35:58 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.114 2011/10/16 12:26:16 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -446,7 +446,9 @@ fdesc_attr(int fd, struct vattr *vap, kauth_cred_t cred)
switch (fp->f_type) {
case DTYPE_VNODE:
vn_lock((struct vnode *) fp->f_data, LK_SHARED | LK_RETRY);
error = VOP_GETATTR((struct vnode *) fp->f_data, vap, cred);
VOP_UNLOCK((struct vnode *) fp->f_data);
if (error == 0 && vap->va_type == VDIR) {
/*
* directories can cause loops in the namespace,

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_map.c,v 1.40 2011/07/26 13:18:55 yamt Exp $ */
/* $NetBSD: procfs_map.c,v 1.41 2011/10/16 12:26:16 hannken Exp $ */
/*
* Copyright (c) 1993
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.40 2011/07/26 13:18:55 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: procfs_map.c,v 1.41 2011/10/16 12:26:16 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -162,7 +162,9 @@ again:
if (UVM_ET_ISOBJ(entry) &&
UVM_OBJ_IS_VNODE(entry->object.uvm_obj)) {
vp = (struct vnode *)entry->object.uvm_obj;
vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, &va, curl->l_cred);
VOP_UNLOCK(vp);
if (error == 0 && vp != pfs->pfs_vnode) {
fileid = va.va_fileid;
dev = va.va_fsid;