aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/random
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-08-11 03:33:32 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-08-11 03:33:32 +0000
commit38c9c1708b198018ba6ddfae9ab7e1ebaeed050c (patch)
tree2c5637ba69f88f5b788543ee9c74630dc1381b42 /sys/dev/random
parent4da47b2fec804742a47b0de6e153f9ae12c68db7 (diff)
Notes
Diffstat (limited to 'sys/dev/random')
-rw-r--r--sys/dev/random/randomdev_soft.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/random/randomdev_soft.c b/sys/dev/random/randomdev_soft.c
index c73e09881b90..6f4851bcfffb 100644
--- a/sys/dev/random/randomdev_soft.c
+++ b/sys/dev/random/randomdev_soft.c
@@ -296,6 +296,10 @@ random_harvest_internal(u_int64_t somecounter, const void *entropy,
{
struct harvest *event;
+ /* Lockless read to avoid lock operations if fifo is full. */
+ if (harvestfifo[origin].count >= RANDOM_FIFO_MAX)
+ return;
+
/* Lock the particular fifo */
mtx_lock_spin(&harvestfifo[origin].lock);