diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-03 17:42:43 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-03 17:42:43 +0000 |
commit | 5f415969804fba14787bbeaa4cd1986ad29f505e (patch) | |
tree | 2f1aa32dbb2aa5aba7d1da80d630de49efb8914a | |
parent | d4c6c3956226605f3d184af05bc2e33179b903c3 (diff) |
Fix vnd(4) support for read-only files. We can't clear sc_flags
before closing the vnode, because VNDRW() checks for the VNF_READONLY
bit and the vnode layer doesn't like it when you close a read-only
vnode with FREAD|FWRITE.
ok deraadt@
-rw-r--r-- | sys/dev/vnd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index cb17d88f6fe..f6b115c6214 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.134 2011/06/30 16:28:05 matthew Exp $ */ +/* $OpenBSD: vnd.c,v 1.135 2011/07/03 17:42:42 matthew Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -699,11 +699,11 @@ vndclear(struct vnd_softc *sc) DNPRINTF(VDB_FOLLOW, "vndclear(%p): vp %p\n", sc, vp); - sc->sc_flags = 0; if (vp == NULL) panic("vndioctl: null vp"); (void) vn_close(vp, VNDRW(sc), sc->sc_cred, p); crfree(sc->sc_cred); + sc->sc_flags = 0; sc->sc_vp = NULL; sc->sc_cred = NULL; sc->sc_size = 0; |