projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hwrng: core - sleep interruptible in read
[cascardo/linux.git]
/
drivers
/
char
/
hw_random
/
core.c
diff --git
a/drivers/char/hw_random/core.c
b/drivers/char/hw_random/core.c
index
6f497aa
..
9203f2d
100644
(file)
--- a/
drivers/char/hw_random/core.c
+++ b/
drivers/char/hw_random/core.c
@@
-238,7
+238,10
@@
static ssize_t rng_dev_read(struct file *filp, char __user *buf,
goto out;
}
goto out;
}
- mutex_lock(&reading_mutex);
+ if (mutex_lock_interruptible(&reading_mutex)) {
+ err = -ERESTARTSYS;
+ goto out_put;
+ }
if (!data_avail) {
bytes_read = rng_get_data(rng, rng_buffer,
rng_buffer_size(),
if (!data_avail) {
bytes_read = rng_get_data(rng, rng_buffer,
rng_buffer_size(),
@@
-288,6
+291,7
@@
out:
out_unlock_reading:
mutex_unlock(&reading_mutex);
out_unlock_reading:
mutex_unlock(&reading_mutex);
+out_put:
put_rng(rng);
goto out;
}
put_rng(rng);
goto out;
}