Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/kern Pull up following revision(s) (requested by rias...



details:   https://anonhg.NetBSD.org/src/rev/f8aaad8b332c
branches:  netbsd-7
changeset: 798251:f8aaad8b332c
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Aug 15 12:56:24 2014 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #22):
        sys/kern/subr_cprng.c: revision 1.25
Lock cprng->cs_lock around rndsink_request to avoid race with callback.

diffstat:

 sys/kern/subr_cprng.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 911135e2410b -r f8aaad8b332c sys/kern/subr_cprng.c
--- a/sys/kern/subr_cprng.c     Fri Aug 15 12:53:54 2014 +0000
+++ b/sys/kern/subr_cprng.c     Fri Aug 15 12:56:24 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_cprng.c,v 1.24 2014/08/10 16:44:36 tls Exp $ */
+/*     $NetBSD: subr_cprng.c,v 1.24.2.1 2014/08/15 12:56:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.24 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.24.2.1 2014/08/15 12:56:24 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -151,6 +151,7 @@
 
        /* Get some initial entropy.  Record whether it is full entropy.  */
        uint8_t seed[NIST_BLOCK_KEYLEN_BYTES];
+       mutex_enter(&cprng->cs_lock);
        cprng->cs_ready = rndsink_request(cprng->cs_rndsink, seed,
            sizeof(seed));
        if (nist_ctr_drbg_instantiate(&cprng->cs_drbg, seed, sizeof(seed),
@@ -168,6 +169,7 @@
        if (!cprng->cs_ready && !ISSET(flags, CPRNG_INIT_ANY))
                printf("cprng %s: creating with partial entropy\n",
                    cprng->cs_name);
+       mutex_exit(&cprng->cs_lock);
 
        return cprng;
 }



Home | Main Index | Thread Index | Old Index