Module Name:    src
Committed By:   tls
Date:           Fri Apr 20 21:57:34 UTC 2012

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

Log Message:
Fix a bug and a compilation problem.  Bug: spin mutexes don't have owners,
so KASSERT(!mutex_owned()) shouldn't be used to assert that the current
LWP does not have the mutex.  Compilation problem: explicitly include
sys/mutex.h from rnd.h so evbarm builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/rndpseudo.c
cvs rdiff -u -r1.31 -r1.32 src/sys/sys/rnd.h

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/rndpseudo.c
diff -u src/sys/dev/rndpseudo.c:1.8 src/sys/dev/rndpseudo.c:1.9
--- src/sys/dev/rndpseudo.c:1.8	Tue Apr 17 02:50:38 2012
+++ src/sys/dev/rndpseudo.c	Fri Apr 20 21:57:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndpseudo.c,v 1.8 2012/04/17 02:50:38 tls Exp $	*/
+/*	$NetBSD: rndpseudo.c,v 1.9 2012/04/20 21:57:33 tls Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.8 2012/04/17 02:50:38 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.9 2012/04/20 21:57:33 tls Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -298,8 +298,6 @@ rnd_read(struct file * fp, off_t *offp, 
 		return EIO;
         }
 
-	KASSERT(!mutex_owned(&cprng->reseed.mtx));
-
 	strength = cprng_strong_strength(cprng);
 	ret = 0;
 	bf = pool_cache_get(rp_pc, PR_WAITOK);
@@ -326,7 +324,7 @@ rnd_read(struct file * fp, off_t *offp, 
 			}
 			goto out;
 		}
-		/* KASSERT(!mutex_owned(&cprng->reseed.mtx)); */
+
 		ret = uiomove((void *)bf, nread, uio);
 		if (ret != 0 || n < want) {
 			goto out;

Index: src/sys/sys/rnd.h
diff -u src/sys/sys/rnd.h:1.31 src/sys/sys/rnd.h:1.32
--- src/sys/sys/rnd.h:1.31	Tue Apr 17 02:50:39 2012
+++ src/sys/sys/rnd.h	Fri Apr 20 21:57:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd.h,v 1.31 2012/04/17 02:50:39 tls Exp $	*/
+/*	$NetBSD: rnd.h,v 1.32 2012/04/20 21:57:34 tls Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
 #include <sys/sha1.h>
 
 #ifdef _KERNEL
+#include <sys/mutex.h>
 #include <sys/queue.h>
 #endif
 

Reply via email to