Module Name:    src
Committed By:   riastradh
Date:           Thu Apr 30 17:16:00 UTC 2020

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

Log Message:
Missed a spot!  (Part II(b) of no percpu_foreach under spin lock.)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/kern/kern_entropy.c:1.5
--- src/sys/kern/kern_entropy.c:1.4	Thu Apr 30 16:50:00 2020
+++ src/sys/kern/kern_entropy.c	Thu Apr 30 17:16:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.4 2020/04/30 16:50:00 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.5 2020/04/30 17:16:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.4 2020/04/30 16:50:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.5 2020/04/30 17:16:00 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -2000,7 +2000,9 @@ entropy_ioctl(unsigned long cmd, void *d
 				break;
 		}
 		while (i < stat->count && rs != NULL) {
+			mutex_exit(&E->lock);
 			rndsource_to_user(rs, &stat->source[i++]);
+			mutex_enter(&E->lock);
 			rs = LIST_NEXT(rs, list);
 		}
 		KASSERT(i <= stat->count);

Reply via email to