summaryrefslogtreecommitdiffstats
path: root/sys/dev/vnd.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2011-06-02 19:09:29 +0000
committerderaadt <deraadt@openbsd.org>2011-06-02 19:09:29 +0000
commitfd2e7775ed9c7f2bde43dbaabffb1c00089a5018 (patch)
tree40a847f90d70a4243f3e3a787d3b5061874ca3d4 /sys/dev/vnd.c
parentIf there are no descriptors to poll, just sleep until SIGALRM (diff)
downloadwireguard-openbsd-fd2e7775ed9c7f2bde43dbaabffb1c00089a5018.tar.xz
wireguard-openbsd-fd2e7775ed9c7f2bde43dbaabffb1c00089a5018.zip
Do not bzero the softc when doing VNDIOCCLR, because that trashes the
rw_lock and the device_ref Discussed with thib and matthew
Diffstat (limited to 'sys/dev/vnd.c')
-rw-r--r--sys/dev/vnd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index ce0b5b2209c..fa7918073f9 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.117 2011/06/02 16:14:40 deraadt Exp $ */
+/* $OpenBSD: vnd.c,v 1.118 2011/06/02 19:09:29 deraadt Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -491,7 +491,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct vnd_user *vnu;
struct vattr vattr;
struct nameidata nd;
- int error, part, pmask, s;
+ int error, part, pmask;
DNPRINTF(VDB_FOLLOW, "vndioctl(%x, %lx, %p, %x, %p): unit %d\n",
dev, cmd, addr, flag, p, unit);
@@ -646,12 +646,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
/* Detach the disk. */
disk_detach(&vnd->sc_dk);
-
- /* This must be atomic. */
- s = splhigh();
vndunlock(vnd);
- bzero(vnd, sizeof(struct vnd_softc));
- splx(s);
break;
case VNDIOCGET:
@@ -801,6 +796,7 @@ vndclear(struct vnd_softc *vnd)
vnd->sc_vp = NULL;
vnd->sc_cred = NULL;
vnd->sc_size = 0;
+ bzero(vnd->sc_file, sizeof(vnd->sc_file));
}
daddr64_t