Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/miscfs/specfs Pull up following revision(s) (reques...
details: https://anonhg.NetBSD.org/src/rev/b9d7b1b385c3
branches: netbsd-2-0
changeset: 564932:b9d7b1b385c3
user: riz <riz%NetBSD.org@localhost>
date: Thu Dec 29 01:36:09 2005 +0000
description:
Pull up following revision(s) (requested by chs in ticket #10207):
sys/miscfs/specfs/spec_vnops.c: revision 1.83
in spec_ioctl(), don't dereference v_specinfo if it's NULL.
this is needed due to rev. 1.231 of kern/vfs_subr.c, which now sets
v_specinfo to NULL before changing the vnode's ops vector.
diffstat:
sys/miscfs/specfs/spec_vnops.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diffs (47 lines):
diff -r 9a945edc22b5 -r b9d7b1b385c3 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Thu Dec 29 01:29:55 2005 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Thu Dec 29 01:36:09 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.77 2004/02/14 00:00:56 hannken Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.77.2.1 2005/12/29 01:36:09 riz Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.77 2004/02/14 00:00:56 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.77.2.1 2005/12/29 01:36:09 riz Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -460,9 +460,26 @@
} */ *ap = v;
const struct bdevsw *bdev;
const struct cdevsw *cdev;
- dev_t dev = ap->a_vp->v_rdev;
+ struct vnode *vp;
+ dev_t dev;
+
+ /*
+ * Extract all the info we need from the vnode, taking care to
+ * avoid a race with VOP_REVOKE().
+ */
- switch (ap->a_vp->v_type) {
+ vp = ap->a_vp;
+ dev = NODEV;
+ simple_lock(&vp->v_interlock);
+ if ((vp->v_flag & VXLOCK) == 0 && vp->v_specinfo) {
+ dev = vp->v_rdev;
+ }
+ simple_unlock(&vp->v_interlock);
+ if (dev == NODEV) {
+ return ENXIO;
+ }
+
+ switch (vp->v_type) {
case VCHR:
cdev = cdevsw_lookup(dev);
Home |
Main Index |
Thread Index |
Old Index