summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 c73e098..6f4851b 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);
OpenPOWER on IntegriCloud