From 7ca5fbf43b3d5fc19ec5d7f5d4b2aba24135fecc Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 2 Jun 2011 19:09:30 +0000 Subject: Do not bzero the softc when doing VNDIOCCLR, because that trashes the rw_lock and the device_ref Discussed with thib and matthew --- sys/dev/vnd.c | 10 +++------- 1 file 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 -- cgit v1.2.3