summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-12-28 02:40:42 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-12-28 02:40:42 +0000
commit0481b66bfbcfb1c51b06053fe9c4518af1878dac (patch)
treed4f8b6b692472770048281c4b6fdc1d98292431f /sys/arch/amd64/stand
parent98401b3d72ebc82a4341cc155b7d120e09ec4453 (diff)
If we fail to decrypt the softraid keys, return EPERM rather than falling
through and failing when we attempt to read and validate the disklabel. Also return ENOTSUP rather than EPERM if an attempt is made to write to a softraid volume.
Diffstat (limited to 'sys/arch/amd64/stand')
-rw-r--r--sys/arch/amd64/stand/libsa/biosdev.c5
-rw-r--r--sys/arch/amd64/stand/libsa/softraid.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c
index 319d9a3bec6..379592bf964 100644
--- a/sys/arch/amd64/stand/libsa/biosdev.c
+++ b/sys/arch/amd64/stand/libsa/biosdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosdev.c,v 1.20 2013/03/23 16:08:27 deraadt Exp $ */
+/* $OpenBSD: biosdev.c,v 1.21 2013/12/28 02:40:41 jsing Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -524,7 +524,8 @@ biosopen(struct open_file *f, ...)
}
if (bv->sbv_level == 'C' && bv->sbv_keys == NULL)
- sr_crypto_decrypt_keys(bv);
+ if (sr_crypto_decrypt_keys(bv) != 0)
+ return EPERM;
if (bv->sbv_diskinfo == NULL) {
dip = alloc(sizeof(struct diskinfo));
diff --git a/sys/arch/amd64/stand/libsa/softraid.c b/sys/arch/amd64/stand/libsa/softraid.c
index b98ec2ef680..5c7f9b3104e 100644
--- a/sys/arch/amd64/stand/libsa/softraid.c
+++ b/sys/arch/amd64/stand/libsa/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.5 2013/10/20 13:25:20 stsp Exp $ */
+/* $OpenBSD: softraid.c,v 1.6 2013/12/28 02:40:41 jsing Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
@@ -333,7 +333,7 @@ sr_strategy(struct sr_boot_volume *bv, int rw, daddr32_t blk, size_t size,
/* We only support read-only softraid. */
if (rw != F_READ)
- return EPERM;
+ return ENOTSUP;
/* Partition offset within softraid volume. */
sr_dip = (struct diskinfo *)bv->sbv_diskinfo;