summaryrefslogtreecommitdiff
path: root/lib/random32.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-31 12:40:13 +0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-31 12:45:15 +0400
commit0654a65f26d4b226c0b3e8a050db100200a6b924 (patch)
tree7b448b84cdc7ec0bbbd1ad6e9500eef94af0bfe8 /lib/random32.c
parente1f23f3dd817f53f622e486913ac662add46eeed (diff)
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
downloadlinux-0654a65f26d4b226c0b3e8a050db100200a6b924.tar.xz
Merge tag 'v3.14' into drm-intel-next-queued
Linux 3.14 The vt-d w/a merged late in 3.14-rc needs a bit of fine-tuning, hence backmerge. Conflicts: drivers/gpu/drm/i915/i915_gem_gtt.c drivers/gpu/drm/i915/intel_ddi.c drivers/gpu/drm/i915/intel_dp.c All trivial adjacent lines changed type conflicts, so trivial git doesn't even show them in the merg commit. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/random32.c')
-rw-r--r--lib/random32.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/random32.c b/lib/random32.c
index 1e5b2df44291..614896778700 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -244,8 +244,19 @@ static void __prandom_reseed(bool late)
static bool latch = false;
static DEFINE_SPINLOCK(lock);
+ /* Asking for random bytes might result in bytes getting
+ * moved into the nonblocking pool and thus marking it
+ * as initialized. In this case we would double back into
+ * this function and attempt to do a late reseed.
+ * Ignore the pointless attempt to reseed again if we're
+ * already waiting for bytes when the nonblocking pool
+ * got initialized.
+ */
+
/* only allow initial seeding (late == false) once */
- spin_lock_irqsave(&lock, flags);
+ if (!spin_trylock_irqsave(&lock, flags))
+ return;
+
if (latch && !late)
goto out;
latch = true;