Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Merge commit. Changes below are compared with the first parent: 2ffb57df.
Changes
1 files changed · +9 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| drivers/char/random.c | modified | +9 | −1 | View file |
drivers/char/random.c
View filediff --git a/drivers/char/random.c b/drivers/char/random.c
index cd888d4..bd449ad 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1895,14 +1895,22 @@ static int
write_pool(struct entropy_store *r, const char __user *buffer, size_t count)
{
size_t bytes;
- __u32 buf[16];
+ __u32 t, buf[16];
const char __user *p = buffer;
while (count > 0) {
+ int b, i = 0;
+
bytes = min(count, sizeof(buf));
if (copy_from_user(&buf, p, bytes))
return -EFAULT;
+ for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) {
+ if (!arch_get_random_int(&t))
+ break;
+ buf[i] ^= t;
+ }
+
count -= bytes;
p += bytes;