diff options
author | 2012-01-22 10:50:39 +0000 | |
---|---|---|
committer | 2012-01-22 10:50:39 +0000 | |
commit | 6f975bdd8f37b67dc92eca929526f9aafb074521 (patch) | |
tree | 6ccad77679309adfa4024275c7ec3d3b0dc2b97f | |
parent | Disable the softraid disk attach hook on detach. (diff) | |
download | wireguard-openbsd-6f975bdd8f37b67dc92eca929526f9aafb074521.tar.xz wireguard-openbsd-6f975bdd8f37b67dc92eca929526f9aafb074521.zip |
Move list initialisation to the start of the function - this prevents us
from walking an uninitialised list if we fail to read the key disk.
-rw-r--r-- | sys/dev/softraid_crypto.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c index 1e8b55096b6..4ba1328c340 100644 --- a/sys/dev/softraid_crypto.c +++ b/sys/dev/softraid_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_crypto.c,v 1.77 2011/12/26 14:54:52 jsing Exp $ */ +/* $OpenBSD: softraid_crypto.c,v 1.78 2012/01/22 10:50:39 jsing Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org> @@ -827,6 +827,8 @@ sr_crypto_read_key_disk(struct sr_discipline *sd, dev_t dev) * Load a key disk and load keying material into memory. */ + SLIST_INIT(&som); + sr_meta_getdevname(sc, dev, devname, sizeof(devname)); /* Make sure chunk is not already in use. */ @@ -898,7 +900,6 @@ sr_crypto_read_key_disk(struct sr_discipline *sd, dev_t dev) sizeof(key_disk->src_meta)); /* Read mask key from optional metadata. */ - SLIST_INIT(&som); sr_meta_opt_load(sc, sm, &som); SLIST_FOREACH(omi, &som, omi_link) { omh = omi->omi_som; |