Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it. The calls from file systems need review. No objections from tech-kern.
This commit is contained in:
parent
b8600d3839
commit
2cc7a01f10
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $ */
|
||||
/* $NetBSD: linux_file.c,v 1.104 2011/10/14 09:23:28 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.104 2011/10/14 09:23:28 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -340,7 +340,9 @@ linux_sys_fcntl(struct lwp *l, const struct linux_sys_fcntl_args *uap, register_
|
|||
break;
|
||||
}
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
fd_putfile(fd);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_file64.c,v 1.52 2011/09/01 12:44:10 njoly Exp $ */
|
||||
/* $NetBSD: linux_file64.c,v 1.53 2011/10/14 09:23:28 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 2000, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.52 2011/09/01 12:44:10 njoly Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.53 2011/10/14 09:23:28 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -258,7 +258,10 @@ linux_sys_getdents64(struct lwp *l, const struct linux_sys_getdents64_args *uap,
|
|||
goto out1;
|
||||
}
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &va, l->l_cred)))
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
goto out1;
|
||||
|
||||
nbytes = SCARG(uap, count);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_ioctl.c,v 1.55 2008/07/19 23:01:52 jmcneill Exp $ */
|
||||
/* $NetBSD: linux_ioctl.c,v 1.56 2011/10/14 09:23:28 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.55 2008/07/19 23:01:52 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.56 2011/10/14 09:23:28 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "sequencer.h"
|
||||
|
@ -128,6 +128,7 @@ linux_sys_ioctl(struct lwp *l, const struct linux_sys_ioctl_args *uap, register_
|
|||
* way. We do it by indexing in the cdevsw with the major
|
||||
* device number and check if that is the sequencer entry.
|
||||
*/
|
||||
bool is_sequencer = false;
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
struct vattr va;
|
||||
|
@ -137,9 +138,15 @@ linux_sys_ioctl(struct lwp *l, const struct linux_sys_ioctl_args *uap, register_
|
|||
return EBADF;
|
||||
if (fp->f_type == DTYPE_VNODE &&
|
||||
(vp = (struct vnode *)fp->f_data) != NULL &&
|
||||
vp->v_type == VCHR &&
|
||||
VOP_GETATTR(vp, &va, l->l_cred) == 0 &&
|
||||
cdevsw_lookup(va.va_rdev) == &sequencer_cdevsw) {
|
||||
vp->v_type == VCHR) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0 &&
|
||||
cdevsw_lookup(va.va_rdev) == &sequencer_cdevsw)
|
||||
is_sequencer = true;
|
||||
}
|
||||
if (is_sequencer) {
|
||||
error = oss_ioctl_sequencer(l, (const void *)LINUX_TO_OSS(uap),
|
||||
retval);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux_misc.c,v 1.218 2010/11/02 18:18:07 chs Exp $ */
|
||||
/* $NetBSD: linux_misc.c,v 1.219 2011/10/14 09:23:28 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -57,7 +57,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.218 2010/11/02 18:18:07 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.219 2011/10/14 09:23:28 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -696,7 +696,10 @@ linux_sys_getdents(struct lwp *l, const struct linux_sys_getdents_args *uap, reg
|
|||
goto out1;
|
||||
}
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &va, l->l_cred)))
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
goto out1;
|
||||
|
||||
nbytes = SCARG(uap, count);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: linux32_dirent.c,v 1.12 2010/09/11 20:53:04 chs Exp $ */
|
||||
/* $NetBSD: linux32_dirent.c,v 1.13 2011/10/14 09:23:29 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.12 2010/09/11 20:53:04 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux32_dirent.c,v 1.13 2011/10/14 09:23:29 hannken Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -130,7 +130,10 @@ linux32_sys_getdents(struct lwp *l, const struct linux32_sys_getdents_args *uap,
|
|||
goto out1;
|
||||
}
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &va, l->l_cred)))
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
goto out1;
|
||||
|
||||
nbytes = SCARG(uap, count);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill Exp $ */
|
||||
/* $NetBSD: ossaudio.c,v 1.67 2011/10/14 09:23:29 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.66 2011/09/06 01:19:34 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.67 2011/10/14 09:23:29 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -935,7 +935,7 @@ getdevinfo(file_t *fp)
|
|||
struct vattr va;
|
||||
static struct audiodevinfo devcache;
|
||||
struct audiodevinfo *di = &devcache;
|
||||
int mlen, dlen;
|
||||
int error, mlen, dlen;
|
||||
|
||||
/*
|
||||
* Figure out what device it is so we can check if the
|
||||
|
@ -944,7 +944,10 @@ getdevinfo(file_t *fp)
|
|||
vp = fp->f_data;
|
||||
if (vp->v_type != VCHR)
|
||||
return 0;
|
||||
if (VOP_GETATTR(vp, &va, kauth_cred_get()))
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, kauth_cred_get());
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
return 0;
|
||||
if (di->done && di->dev == va.va_rdev)
|
||||
return di;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_fcntl.c,v 1.70 2008/04/28 20:23:45 martin Exp $ */
|
||||
/* $NetBSD: svr4_fcntl.c,v 1.71 2011/10/14 09:23:29 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1997, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_fcntl.c,v 1.70 2008/04/28 20:23:45 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_fcntl.c,v 1.71 2011/10/14 09:23:29 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -263,7 +263,10 @@ fd_truncate(struct lwp *l, int fd, struct flock *flp, register_t *retval)
|
|||
fd_putfile(fd);
|
||||
return ESPIPE;
|
||||
}
|
||||
if ((error = VOP_GETATTR(vp, &vattr, l->l_cred)) != 0) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
fd_putfile(fd);
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_32_fcntl.c,v 1.34 2008/04/28 20:23:46 martin Exp $ */
|
||||
/* $NetBSD: svr4_32_fcntl.c,v 1.35 2011/10/14 09:23:29 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1997, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_fcntl.c,v 1.34 2008/04/28 20:23:46 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_fcntl.c,v 1.35 2011/10/14 09:23:29 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -261,7 +261,10 @@ fd_truncate(struct lwp *l, int fd, struct flock *flp, register_t *retval)
|
|||
fd_putfile(fd);
|
||||
return ESPIPE;
|
||||
}
|
||||
if ((error = VOP_GETATTR(vp, &vattr, l->l_cred)) != 0) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
fd_putfile(fd);
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ccd.c,v 1.141 2011/07/04 16:06:45 joerg Exp $ */
|
||||
/* $NetBSD: ccd.c,v 1.142 2011/10/14 09:23:29 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -88,7 +88,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.141 2011/07/04 16:06:45 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.142 2011/10/14 09:23:29 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -310,7 +310,10 @@ ccdinit(struct ccd_softc *cs, char **cpaths, struct vnode **vpp,
|
|||
/*
|
||||
* XXX: Cache the component's dev_t.
|
||||
*/
|
||||
if ((error = VOP_GETATTR(vpp[ix], &va, l->l_cred)) != 0) {
|
||||
vn_lock(vpp[ix], LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vpp[ix], &va, l->l_cred);
|
||||
VOP_UNLOCK(vpp[ix]);
|
||||
if (error != 0) {
|
||||
#ifdef DEBUG
|
||||
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
|
||||
printf("%s: %s: getattr failed %s = %d\n",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cgd.c,v 1.74 2011/06/21 06:23:38 jruoho Exp $ */
|
||||
/* $NetBSD: cgd.c,v 1.75 2011/10/14 09:23:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.74 2011/06/21 06:23:38 jruoho Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.75 2011/10/14 09:23:30 hannken Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -773,7 +773,10 @@ cgdinit(struct cgd_softc *cs, const char *cpath, struct vnode *vp,
|
|||
cs->sc_tpath = malloc(cs->sc_tpathlen, M_DEVBUF, M_WAITOK);
|
||||
memcpy(cs->sc_tpath, tmppath, cs->sc_tpathlen);
|
||||
|
||||
if ((ret = VOP_GETATTR(vp, &va, l->l_cred)) != 0)
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
ret = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (ret != 0)
|
||||
goto bail;
|
||||
|
||||
cs->sc_tdev = va.va_rdev;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dm_target_linear.c,v 1.12 2010/12/23 14:58:13 mlelstv Exp $ */
|
||||
/* $NetBSD: dm_target_linear.c,v 1.13 2011/10/14 09:23:30 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -201,7 +201,10 @@ dm_target_linear_deps(dm_table_entry_t * table_en, prop_array_t prop_array)
|
|||
|
||||
tlc = table_en->target_config;
|
||||
|
||||
if ((error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred)) != 0)
|
||||
vn_lock(tlc->pdev->pdev_vnode, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(tlc->pdev->pdev_vnode);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dm_target_snapshot.c,v 1.14 2010/12/23 14:58:13 mlelstv Exp $ */
|
||||
/* $NetBSD: dm_target_snapshot.c,v 1.15 2011/10/14 09:23:30 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -357,15 +357,21 @@ dm_target_snapshot_deps(dm_table_entry_t * table_en,
|
|||
|
||||
tsc = table_en->target_config;
|
||||
|
||||
if ((error = VOP_GETATTR(tsc->tsc_snap_dev->pdev_vnode, &va, curlwp->l_cred)) != 0)
|
||||
vn_lock(tsc->tsc_snap_dev->pdev_vnode, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(tsc->tsc_snap_dev->pdev_vnode, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(tsc->tsc_snap_dev->pdev_vnode);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
|
||||
|
||||
if (tsc->tsc_persistent_dev) {
|
||||
|
||||
if ((error = VOP_GETATTR(tsc->tsc_cow_dev->pdev_vnode, &va,
|
||||
curlwp->l_cred)) != 0)
|
||||
vn_lock(tsc->tsc_cow_dev->pdev_vnode, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(tsc->tsc_cow_dev->pdev_vnode, &va,
|
||||
curlwp->l_cred);
|
||||
VOP_UNLOCK(tsc->tsc_cow_dev->pdev_vnode);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
|
||||
|
@ -534,8 +540,11 @@ dm_target_snapshot_orig_deps(dm_table_entry_t * table_en,
|
|||
|
||||
tsoc = table_en->target_config;
|
||||
|
||||
if ((error = VOP_GETATTR(tsoc->tsoc_real_dev->pdev_vnode, &va,
|
||||
curlwp->l_cred)) != 0)
|
||||
vn_lock(tsoc->tsoc_real_dev->pdev_vnode, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(tsoc->tsoc_real_dev->pdev_vnode, &va,
|
||||
curlwp->l_cred);
|
||||
VOP_UNLOCK(tsoc->tsoc_real_dev->pdev_vnode);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*$NetBSD: dm_target_stripe.c,v 1.15 2011/08/27 17:09:09 ahoka Exp $*/
|
||||
/*$NetBSD: dm_target_stripe.c,v 1.16 2011/10/14 09:23:30 hannken Exp $*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -329,7 +329,10 @@ dm_target_stripe_deps(dm_table_entry_t * table_en, prop_array_t prop_array)
|
|||
tsc = table_en->target_config;
|
||||
|
||||
TAILQ_FOREACH(tlc, &tsc->stripe_devs, entries) {
|
||||
if ((error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred)) != 0)
|
||||
vn_lock(tlc->pdev->pdev_vnode, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(tlc->pdev->pdev_vnode, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(tlc->pdev->pdev_vnode);
|
||||
if (error != 0)
|
||||
return error;
|
||||
|
||||
prop_array_add_uint64(prop_array, (uint64_t) va.va_rdev);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_copyback.c,v 1.48 2011/08/03 14:44:38 oster Exp $ */
|
||||
/* $NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -38,7 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.48 2011/08/03 14:44:38 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.49 2011/10/14 09:23:30 hannken Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -160,7 +160,10 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr)
|
|||
/* Ok, so we can at least do a lookup... How about actually
|
||||
* getting a vp for it? */
|
||||
|
||||
if ((retcode = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0)
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (retcode != 0)
|
||||
return;
|
||||
retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]);
|
||||
if (retcode) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_disks.c,v 1.81 2011/08/03 14:44:38 oster Exp $ */
|
||||
/* $NetBSD: rf_disks.c,v 1.82 2011/10/14 09:23:30 hannken Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -60,7 +60,7 @@
|
|||
***************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.81 2011/08/03 14:44:38 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.82 2011/10/14 09:23:30 hannken Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -630,7 +630,10 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *bf, RF_RaidDisk_t *diskPtr,
|
|||
raidPtr->bytesPerSector = diskPtr->blockSize;
|
||||
|
||||
if (diskPtr->status == rf_ds_optimal) {
|
||||
if ((error = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0)
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
raidPtr->raid_cinfo[col].ci_vp = vp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_reconstruct.c,v 1.116 2011/08/03 15:00:29 oster Exp $ */
|
||||
/* $NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.116 2011/08/03 15:00:29 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -456,7 +456,10 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t col)
|
|||
/* Ok, so we can at least do a lookup...
|
||||
How about actually getting a vp for it? */
|
||||
|
||||
if ((retcode = VOP_GETATTR(vp, &va, curlwp->l_cred)) != 0) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
retcode = VOP_GETATTR(vp, &va, curlwp->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (retcode != 0) {
|
||||
vn_close(vp, FREAD | FWRITE, kauth_cred_get());
|
||||
rf_lock_mutex2(raidPtr->mutex);
|
||||
raidPtr->reconInProgress--;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vnd.c,v 1.218 2011/06/29 09:12:42 hannken Exp $ */
|
||||
/* $NetBSD: vnd.c,v 1.219 2011/10/14 09:23:30 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -91,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.218 2011/06/29 09:12:42 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.219 2011/10/14 09:23:30 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vnd.h"
|
||||
|
@ -918,6 +918,7 @@ vndwrite(dev_t dev, struct uio *uio, int flags)
|
|||
static int
|
||||
vnd_cget(struct lwp *l, int unit, int *un, struct vattr *va)
|
||||
{
|
||||
int error;
|
||||
struct vnd_softc *vnd;
|
||||
|
||||
if (*un == -1)
|
||||
|
@ -932,7 +933,10 @@ vnd_cget(struct lwp *l, int unit, int *un, struct vattr *va)
|
|||
if ((vnd->sc_flags & VNF_INITED) == 0)
|
||||
return -1;
|
||||
|
||||
return VOP_GETATTR(vnd->sc_vp, va, l->l_cred);
|
||||
vn_lock(vnd->sc_vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vnd->sc_vp, va, l->l_cred);
|
||||
VOP_UNLOCK(vnd->sc_vp);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_verifiedexec.c,v 1.126 2011/09/01 18:33:11 matt Exp $ */
|
||||
/* $NetBSD: kern_verifiedexec.c,v 1.127 2011/10/14 09:23:31 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.126 2011/09/01 18:33:11 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.127 2011/10/14 09:23:31 hannken Exp $");
|
||||
|
||||
#include "opt_veriexec.h"
|
||||
|
||||
|
@ -411,7 +411,9 @@ veriexec_fp_calc(struct lwp *l, struct vnode *vp, int lock_state,
|
|||
size_t resid, npages;
|
||||
int error, do_perpage, pagen;
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_mount.c,v 1.10 2011/10/07 09:35:05 hannken Exp $ */
|
||||
/* $NetBSD: vfs_mount.c,v 1.11 2011/10/14 09:23:31 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.10 2011/10/07 09:35:05 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.11 2011/10/14 09:23:31 hannken Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -664,8 +664,14 @@ mount_domount(struct lwp *l, vnode_t **vpp, struct vfsops *vfsops,
|
|||
* If the user is not root, ensure that they own the directory
|
||||
* onto which we are attempting to mount.
|
||||
*/
|
||||
if ((error = VOP_GETATTR(vp, &va, l->l_cred)) != 0 ||
|
||||
(va.va_uid != kauth_cred_geteuid(l->l_cred) &&
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0) {
|
||||
vfs_delref(vfsops);
|
||||
return error;
|
||||
}
|
||||
if ((va.va_uid != kauth_cred_geteuid(l->l_cred) &&
|
||||
(error = kauth_authorize_generic(l->l_cred,
|
||||
KAUTH_GENERIC_ISSUSER, NULL)) != 0)) {
|
||||
vfs_delref(vfsops);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_syscalls.c,v 1.439 2011/08/22 22:12:34 enami Exp $ */
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.440 2011/10/14 09:23:31 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -70,7 +70,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.439 2011/08/22 22:12:34 enami Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.440 2011/10/14 09:23:31 hannken Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_fileassoc.h"
|
||||
|
@ -2160,7 +2160,9 @@ sys_lseek(struct lwp *l, const struct sys_lseek_args *uap, register_t *retval)
|
|||
newoff = fp->f_offset + SCARG(uap, offset);
|
||||
break;
|
||||
case SEEK_END:
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -3828,7 +3830,10 @@ dorevoke(struct vnode *vp, kauth_cred_t cred)
|
|||
struct vattr vattr;
|
||||
int error;
|
||||
|
||||
if ((error = VOP_GETATTR(vp, &vattr, cred)) != 0)
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0)
|
||||
return error;
|
||||
if (kauth_cred_geteuid(cred) == vattr.va_uid ||
|
||||
(error = kauth_authorize_generic(cred,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vfs_vnops.c,v 1.182 2011/08/16 22:33:38 yamt Exp $ */
|
||||
/* $NetBSD: vfs_vnops.c,v 1.183 2011/10/14 09:23:31 hannken Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.182 2011/08/16 22:33:38 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.183 2011/10/14 09:23:31 hannken Exp $");
|
||||
|
||||
#include "veriexec.h"
|
||||
|
||||
|
@ -689,8 +689,9 @@ vn_ioctl(file_t *fp, u_long com, void *data)
|
|||
case VREG:
|
||||
case VDIR:
|
||||
if (com == FIONREAD) {
|
||||
error = VOP_GETATTR(vp, &vattr,
|
||||
kauth_cred_get());
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, kauth_cred_get());
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
*(int *)data = vattr.va_size - fp->f_offset;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: vnode_if.src,v 1.62 2011/07/11 08:23:00 hannken Exp $
|
||||
# $NetBSD: vnode_if.src,v 1.63 2011/10/14 09:23:31 hannken Exp $
|
||||
#
|
||||
# Copyright (c) 1992, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
|
@ -141,7 +141,7 @@ vop_access {
|
|||
};
|
||||
|
||||
#
|
||||
#% getattr vp = = =
|
||||
#% getattr vp L L L
|
||||
#
|
||||
vop_getattr {
|
||||
IN struct vnode *vp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_mmap.c,v 1.138 2011/10/12 00:03:47 yamt Exp $ */
|
||||
/* $NetBSD: uvm_mmap.c,v 1.139 2011/10/14 09:23:31 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
||||
|
@ -46,7 +46,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.138 2011/10/12 00:03:47 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.139 2011/10/14 09:23:31 hannken Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_pax.h"
|
||||
|
@ -460,8 +460,10 @@ sys_mmap(struct lwp *l, const struct sys_mmap_args *uap, register_t *retval)
|
|||
* EPERM.
|
||||
*/
|
||||
if (fp->f_flag & FWRITE) {
|
||||
if ((error =
|
||||
VOP_GETATTR(vp, &va, l->l_cred))) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, l->l_cred);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
fd_putfile(fd);
|
||||
return (error);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue