From 419fe6e559506771fc7c34bc340262bcbda8b81b Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Sun, 3 Nov 2019 03:20:16 +0000 Subject: 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 after recent changes making vn_open more picky about the structure it is called with. --- sys/dev/vnd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.3