summaryrefslogtreecommitdiffstats
path: root/sys/dev/vnd.c
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2011-05-31 17:35:35 +0000
committermatthew <matthew@openbsd.org>2011-05-31 17:35:35 +0000
commita2f17f2e2ddfd86923342c54aa3dd691f8e08b91 (patch)
tree1d9bb0c5f04c49ea9c717c90c1d268add0f57bc2 /sys/dev/vnd.c
parentfix typos in comment (diff)
downloadwireguard-openbsd-a2f17f2e2ddfd86923342c54aa3dd691f8e08b91.tar.xz
wireguard-openbsd-a2f17f2e2ddfd86923342c54aa3dd691f8e08b91.zip
Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)
to return EBUSY if the user tries to modify an open partition's offset or size. Only sadness can result if a user tries this, and rejecting it prevents a race between sdstart() and sdstrategy(). Curiously, there was already code in the kernel and in disklabel(8) to detect/handle this, but it was effectively disabled because the disk drivers always used something like "/* sc->sc_dk.dk_openmask */ 0", and this commented out code has existed since even r1.1 in NetBSD. I had no problems building a release and messing around with disklabel(8) for a bit with this diff. Canarying the more common MI disk drivers until we gain confidence that there aren't any regressions, then we can switch the remaining drivers. "I am surprised you got me convinced that this stuff is safe" deraadt@ ok krw@
Diffstat (limited to 'sys/dev/vnd.c')
-rw-r--r--sys/dev/vnd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 258bd2ec99f..9aac667a038 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.115 2011/05/30 21:15:03 oga Exp $ */
+/* $OpenBSD: vnd.c,v 1.116 2011/05/31 17:35:35 matthew Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -722,7 +722,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
vnd->sc_flags |= VNF_LABELLING;
error = setdisklabel(vnd->sc_dk.dk_label,
- (struct disklabel *)addr, /*vnd->sc_dk.dk_openmask : */0);
+ (struct disklabel *)addr, vnd->sc_dk.dk_openmask);
if (error == 0) {
if (cmd == DIOCWDINFO)
error = writedisklabel(VNDLABELDEV(dev),