Skip to content

Commit

Permalink
[S390] prng: prevent access beyond end of stack
Browse files Browse the repository at this point in the history
While initializing the state of the prng only the first 8 bytes of
random data where used, the second 8 bytes were read from the memory
after the stack. If only 64 bytes of the kernel stack are used and
CONFIG_DEBUG_PAGEALLOC is enabled a kernel panic may occur because of
the invalid page access. Use the correct multiplicator to stay within
the random data buffer.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Jan Glauber authored and Martin Schwidefsky committed Apr 20, 2011
1 parent 65f8da4 commit c708c57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/crypto/prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void prng_seed(int nbytes)

/* Add the entropy */
while (nbytes >= 8) {
*((__u64 *)parm_block) ^= *((__u64 *)buf+i*8);
*((__u64 *)parm_block) ^= *((__u64 *)buf+i);
prng_add_entropy();
i += 8;
nbytes -= 8;
Expand Down

0 comments on commit c708c57

Please sign in to comment.