summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-05-06 20:42:52 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-05-06 20:42:52 +0000
commitea2a254842c844fb2a2272dc2da859fe0959d418 (patch)
tree6e96199d99d8b0d712e5bbd3e025f791851586c0 /sys/kern/vfs_lookup.c
parentf7c753712d59639b9eac56ea6f556eb65e44aaa5 (diff)
avoid doing a lookup on no longer mounted directories.
fixes a crash with forced unmounts. from netbsd
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 5a1b249a389..b0b0ec0f4d5 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.23 2003/05/04 00:22:12 tedu Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.24 2003/05/06 20:42:51 tedu Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -167,6 +167,11 @@ namei(ndp)
VREF(dp);
}
for (;;) {
+ if (!dp->v_mount) {
+ /* Give up if the directory is no longer mounted */
+ FREE(cnp->cn_pnbuf, M_NAMEI);
+ return (ENOENT);
+ }
cnp->cn_nameptr = cnp->cn_pnbuf;
ndp->ni_startdir = dp;
if ((error = lookup(ndp)) != 0) {