Module Name:    src
Committed By:   pooka
Date:           Tue Sep  8 20:57:59 UTC 2009

Modified Files:
        src/sys/dev: rnd.c

Log Message:
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 locked,
wakeups will simply be skipped.

fix from Juho Salminen in PR kern/42020.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/rnd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/rnd.c
diff -u src/sys/dev/rnd.c:1.73 src/sys/dev/rnd.c:1.74
--- src/sys/dev/rnd.c:1.73	Tue Sep  8 20:07:35 2009
+++ src/sys/dev/rnd.c	Tue Sep  8 20:57:59 2009
@@ -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;
 

Reply via email to