diff options
author | 2011-01-06 17:32:42 +0000 | |
---|---|---|
committer | 2011-01-06 17:32:42 +0000 | |
commit | 1e2672a1856a9c011a20b69005b9690c95fb7b30 (patch) | |
tree | bf74168c3ac49659ef6fbf7bcbf4b2c60b32cf11 | |
parent | rephrase fsck question and default to 'n'; ok krw@ henning@ stsp@ (diff) | |
download | wireguard-openbsd-1e2672a1856a9c011a20b69005b9690c95fb7b30.tar.xz wireguard-openbsd-1e2672a1856a9c011a20b69005b9690c95fb7b30.zip |
init and destory the bufq in the ioctl handler, as
the softc is zero'ed when the vnd is unconfigured;
otherwise we blow up when configuring a vnd the second
time since the bufq structure is kaputt.
found by and OK krw@
-rw-r--r-- | sys/dev/vnd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index e8b0a7cf78e..0a18e297a8b 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.105 2011/01/05 15:35:43 thib Exp $ */ +/* $OpenBSD: vnd.c,v 1.106 2011/01/06 17:32:42 thib Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -210,7 +210,6 @@ vndattach(int num) vnd_softc = (struct vnd_softc *)mem; for (i = 0; i < num; i++) { rw_init(&vnd_softc[i].sc_rwlock, "vndlock"); - bufq_init(&vnd_softc[i].sc_bufq, BUFQ_DEFAULT); } numvnd = num; @@ -872,6 +871,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) /* Attach the disk. */ vnd->sc_dk.dk_name = vnd->sc_dk_name; disk_attach(&vnd->sc_dev, &vnd->sc_dk); + bufq_init(&vnd->sc_bufq, BUFQ_DEFAULT); vndunlock(vnd); @@ -908,6 +908,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) } /* Detach the disk. */ + bufq_destroy(&vnd->sc_bufq); disk_detach(&vnd->sc_dk); /* This must be atomic. */ |