diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2019-11-03 03:20:16 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2019-11-03 03:20:16 +0000 |
commit | 419fe6e559506771fc7c34bc340262bcbda8b81b (patch) | |
tree | 2423e629880bb728fa07faf127dbe0dc652ba056 | |
parent | 89ec712cb53ed73c7d88482778a232051365f4af (diff) |
Correctly re-initialize the nameinfo struct that is re-used for
vn_open when vnconfig'ing from a read-only filesystem. This bug has
been with us for a long time and was spotted by Kawamata Yoshihiro
<kaw@on.rim.or.jp> after recent changes making vn_open more
picky about the structure it is called with.
-rw-r--r-- | sys/dev/vnd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index b5044cc8e57..1aa3a8b89ca 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.169 2019/10/06 16:24:14 beck Exp $ */ +/* $OpenBSD: vnd.c,v 1.170 2019/11/03 03:20:15 beck Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -448,6 +448,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) sc->sc_flags &= ~VNF_READONLY; error = vn_open(&nd, FREAD|FWRITE, 0); if (error == EROFS) { + NDINIT(&nd, 0, 0, UIO_USERSPACE, vio->vnd_file, p); sc->sc_flags |= VNF_READONLY; error = vn_open(&nd, FREAD, 0); } |