diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2011-01-06 17:32:43 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2011-01-06 17:32:43 +0000 |
commit | a95c7bc1320904a3339e9e7cf46bc1b03724db44 (patch) | |
tree | f802f03a4053908a2717d10f7c67e3aab7fb294a /sys | |
parent | c2d3c0784bbcc1f05d35c41ccd5099ee2166cfc5 (diff) |
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@
Diffstat (limited to 'sys')
-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. */ |