summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthib <thib@openbsd.org>2010-07-08 09:46:50 +0000
committerthib <thib@openbsd.org>2010-07-08 09:46:50 +0000
commita6aba59054d396f44d80069fc961bdd9aab7d460 (patch)
tree8b81b7933cbca437607201bd5a4de996c390910f
parentUpdate after kroute.c change. As a goody print the route priority. (diff)
downloadwireguard-openbsd-a6aba59054d396f44d80069fc961bdd9aab7d460.tar.xz
wireguard-openbsd-a6aba59054d396f44d80069fc961bdd9aab7d460.zip
Revert part of previous.
The splvm protection is needed after all, as we are walking the list of registered crypto drivers and doing that unprotected is unwise. Pointed out by kettenis@
-rw-r--r--sys/crypto/crypto.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/crypto/crypto.c b/sys/crypto/crypto.c
index 48dbee25c84..e34936c5bc4 100644
--- a/sys/crypto/crypto.c
+++ b/sys/crypto/crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto.c,v 1.55 2010/07/08 08:12:48 thib Exp $ */
+/* $OpenBSD: crypto.c,v 1.56 2010/07/08 09:46:50 thib Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -52,6 +52,8 @@ crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard)
if (crypto_drivers == NULL)
return EINVAL;
+ s = splvm();
+
/*
* The algorithm we use here is pretty stupid; just use the
* first driver that supports all the algorithms we need. Do
@@ -146,10 +148,10 @@ crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard)
* XXX layer right about here.
*/
- if (hid == -1)
+ if (hid == -1) {
+ splx(s);
return EINVAL;
-
- s = splvm();
+ }
/* Call the driver initialization routine. */
lid = hid; /* Pass the driver ID. */