From: Michael Buesch <mb@bu3sch.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org
Subject: [PATCH] hw_random core: block read, if !O_NONBLOCK
Date: Sat, 27 May 2006 00:45:48 +0200 [thread overview]
Message-ID: <200605270045.48642.mb@bu3sch.de> (raw)
Please apply this to -mm. It might also be desireable
to queue the whole hw_random rewrite for 2.6.18 after this
fix is merged.
--
Block reads to /dev/hwrng if O_NONBLOCK is not set.
This restores the old behavior, to not break userland (rngd).
Thanks to Valdis.Kletnieks@vt.edu for pointing out the issue.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: hwrng.fixes/drivers/char/hw_random/core.c
===================================================================
--- hwrng.fixes.orig/drivers/char/hw_random/core.c 2006-05-16 21:52:47.000000000 +0200
+++ hwrng.fixes/drivers/char/hw_random/core.c 2006-05-27 00:39:08.000000000 +0200
@@ -125,7 +125,7 @@
mutex_unlock(&rng_mutex);
err = -EAGAIN;
- if (!bytes_read)
+ if (!bytes_read && (filp->f_flags & O_NONBLOCK))
goto out;
err = -EFAULT;
@@ -138,6 +138,9 @@
data >>= 8;
}
+ if (need_resched())
+ schedule_timeout_interruptible(1);
+ err = -ERESTARTSYS;
if (signal_pending(current))
goto out;
}
reply other threads:[~2006-05-26 22:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200605270045.48642.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox