aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRalph Wuerthner <rwuerthn@de.ibm.com>2008-04-17 01:46:14 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-04-17 01:47:02 -0400
commit893f11286644780fc7d6d415e537644da7bdaaf8 (patch)
tree600401989687c7f7815ed119d2420b9228dd7e8d /drivers/char
parentc10fde0d9e2112c25052a8742e893ec5965c0007 (diff)
[S390] hw_random: allow rng_dev_read() to return hardware errors.
The api for hardware random number generators is currently limited to devices that never fail. If the hardware is registered as a source for random numbers it has to work. This prevents the use of i/o based random number devices where the i/o might fail. Add a check for errors after the read from a hardware random number device. This patch is required to support large random numbers retrieved from the CEX2C cards on System z. Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 84cdf9025737..349b6edc5794 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -116,6 +116,10 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
116 err = -EAGAIN; 116 err = -EAGAIN;
117 if (!bytes_read && (filp->f_flags & O_NONBLOCK)) 117 if (!bytes_read && (filp->f_flags & O_NONBLOCK))
118 goto out; 118 goto out;
119 if (bytes_read < 0) {
120 err = bytes_read;
121 goto out;
122 }
119 123
120 err = -EFAULT; 124 err = -EFAULT;
121 while (bytes_read && size) { 125 while (bytes_read && size) {