Source-Changes-HG archive

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

[src/trunk]: src/sys/dev rnd_wakeup_readers() uses rndpool_mtx for its own co...



details:   https://anonhg.NetBSD.org/src/rev/30519c428f7c
branches:  trunk
changeset: 747299:30519c428f7c
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Sep 08 20:57:59 2009 +0000

description:
rnd_wakeup_readers() uses rndpool_mtx for its own consistency
management, so it cannot be called with the mutex held.  There is
no consistency requirement to synchronize over the whole add-and-wakeup
operation, as if data is consumed in the window the mutex is unlocked,
wakeups will simply be skipped.
fix from Juho Salminen in PR kern/42020.

diffstat:

 sys/dev/rnd.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 1bd8e8f4d134 -r 30519c428f7c sys/dev/rnd.c
--- a/sys/dev/rnd.c     Tue Sep 08 20:37:45 2009 +0000
+++ b/sys/dev/rnd.c     Tue Sep 08 20:57:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rnd.c,v 1.73 2009/09/08 20:07:35 pooka Exp $   */
+/*     $NetBSD: rnd.c,v 1.74 2009/09/08 20:57:59 pooka Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.73 2009/09/08 20:07:35 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.74 2009/09/08 20:57:59 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -653,9 +653,9 @@
                mutex_enter(&rndpool_mtx);
                rndpool_add_data(&rnd_pool, rnddata->data, rnddata->len,
                    rnddata->entropy);
+               mutex_exit(&rndpool_mtx);
 
                rnd_wakeup_readers();
-               mutex_exit(&rndpool_mtx);
 
                break;
 



Home | Main Index | Thread Index | Old Index