summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2011-12-28 16:02:45 +0000
committerjsing <jsing@openbsd.org>2011-12-28 16:02:45 +0000
commit0da7212d11854a705dc46b9a01cba9ac0ed0f214 (patch)
tree4e5d48ea70ec772c35541a6d879449ee48f3d267 /sys/dev/softraid.c
parentsndiod(1) does not 'reload', so set rc_reload to NO. (diff)
downloadwireguard-openbsd-0da7212d11854a705dc46b9a01cba9ac0ed0f214.tar.xz
wireguard-openbsd-0da7212d11854a705dc46b9a01cba9ac0ed0f214.zip
Avoid the use of an invalid disklabel by setting a DK_LABELVALID flag
if we correctly read and validated the disklabel. Always check that this flag is set before using the DUID from the disklabel. Discussed with deraadt@ ok krw@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 1eee7e40c93..a30870140e2 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.260 2011/12/26 14:54:52 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.261 2011/12/28 16:02:45 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -3389,6 +3389,7 @@ sr_ioctl_installboot(struct sr_softc *sc, struct bioc_installboot *bb)
if (!strncmp(dk->dk_name, bb->bb_dev, sizeof(bb->bb_dev)))
break;
if (dk == NULL || dk->dk_label == NULL ||
+ (dk->dk_flags & DKF_LABELVALID) == 0 ||
bcmp(dk->dk_label->d_uid, &duid, sizeof(duid)) == 0) {
printf("%s: failed to get DUID for softraid volume!\n",
DEVNAME(sd->sd_sc));