Greg Kurz 24c65bc703 hwrng: pseries - port to new read API and fix stack corruption
The add_early_randomness() function in drivers/char/hw_random/core.c passes
a 16-byte buffer to pseries_rng_data_read(). Unfortunately, plpar_hcall()
returns four 64-bit values and trashes 16 bytes on the stack.

This bug has been lying around for a long time. It got unveiled by:

commit d3cc7996473a7bdd33256029988ea690754e4e2a
Author: Amit Shah <amit.shah@redhat.com>
Date:   Thu Jul 10 15:42:34 2014 +0530

    hwrng: fetch randomness only after device init

It may trig a oops while loading or unloading the pseries-rng module for both
PowerVM and PowerKVM guests.

This patch does two things:
- pass an intermediate well sized buffer to plpar_hcall(). This is acceptalbe
  since we're not on a hot path.
- move to the new read API so that we know the return buffer size for sure.

Cc: stable@vger.kernel.org
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2014-11-06 23:10:22 +08:00
..
2014-08-02 06:43:51 +10:00
2014-09-23 23:44:16 -07:00
2013-05-05 00:11:29 -04:00
2013-02-22 23:31:31 -05:00
2013-05-05 00:12:29 -04:00
2013-05-05 00:12:29 -04:00
2014-09-23 23:26:42 -07:00
2014-09-23 23:44:16 -07:00
2013-12-18 16:39:54 -08:00
2014-09-23 23:44:16 -07:00
2012-11-21 12:55:19 -08:00
2011-03-31 11:26:23 -03:00
2013-12-19 15:10:49 +01:00
2013-02-22 23:31:31 -05:00
2012-03-28 18:30:03 +01:00
2012-10-07 07:22:32 -07:00
2013-02-22 23:31:31 -05:00
2011-01-10 08:51:44 -08:00
2013-02-22 23:31:31 -05:00
2013-10-16 12:36:10 -07:00
2014-04-16 14:21:06 -07:00