Module Name:    src
Committed By:   riastradh
Date:           Tue May 12 20:50:17 UTC 2020

Modified Files:
        src/sys/kern: kern_entropy.c

Log Message:
Don't invoke callbacks of rndsources with collection disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/kern_entropy.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/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.21 src/sys/kern/kern_entropy.c:1.22
--- src/sys/kern/kern_entropy.c:1.21	Sun May 10 02:56:12 2020
+++ src/sys/kern/kern_entropy.c	Tue May 12 20:50:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.21 2020/05/10 02:56:12 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.22 2020/05/12 20:50:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.21 2020/05/10 02:56:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.22 2020/05/12 20:50:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1687,6 +1687,13 @@ entropy_request(size_t nbytes)
 		if (!ISSET(rs->flags, RND_FLAG_HASCB))
 			continue;
 
+		/*
+		 * Skip sources that are disabled altogether -- we
+		 * would just ignore their samples anyway.
+		 */
+		if (ISSET(rs->flags, RND_FLAG_NO_COLLECT))
+			continue;
+
 		/* Drop the lock while we call the callback.  */
 		if (E->stage >= ENTROPY_WARM)
 			mutex_exit(&E->lock);

Reply via email to