Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't invoke callbacks of rndsources with collectio...



details:   https://anonhg.NetBSD.org/src/rev/a482f3828e16
branches:  trunk
changeset: 932621:a482f3828e16
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue May 12 20:50:17 2020 +0000

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

diffstat:

 sys/kern/kern_entropy.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 4d3e3d346415 -r a482f3828e16 sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Tue May 12 17:26:43 2020 +0000
+++ b/sys/kern/kern_entropy.c   Tue May 12 20:50:17 2020 +0000
@@ -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 @@
                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);



Home | Main Index | Thread Index | Old Index