From: Greg Kurz Date: Fri, 31 Oct 2014 06:50:11 +0000 (+0100) Subject: hwrng: pseries - port to new read API and fix stack corruption X-Git-Tag: omap-for-v3.19/fixes-for-merge-window~129^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24c65bc7037e7d0f362c0df70d17dd72ee64b8b9;p=pandora-kernel.git 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 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 Signed-off-by: Herbert Xu --- Reading git-diff-tree failed