From: jsing Date: Sat, 28 Dec 2013 02:40:41 +0000 (+0000) Subject: If we fail to decrypt the softraid keys, return EPERM rather than falling X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a8401cd3de67c28f9d5b83ea351890b9d3473e4f;p=openbsd 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. --- 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 @@ -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; diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index 2967e7ea162..fcc2681c09f 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.87 2013/03/23 16:08:29 deraadt Exp $ */ +/* $OpenBSD: biosdev.c,v 1.88 2013/12/28 02:40:41 jsing Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -525,7 +525,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/i386/stand/libsa/softraid.c b/sys/arch/i386/stand/libsa/softraid.c index a3f4caad640..5c7f9b3104e 100644 --- a/sys/arch/i386/stand/libsa/softraid.c +++ b/sys/arch/i386/stand/libsa/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.5 2013/10/20 13:25:21 stsp Exp $ */ +/* $OpenBSD: softraid.c,v 1.6 2013/12/28 02:40:41 jsing Exp $ */ /* * Copyright (c) 2012 Joel Sing @@ -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;