[PATCH] hwrng: core - allocate a one page buffer

2020-08-06 Thread Laurent Vivier
/s # dd if=/dev/hwrng of=/dev/null bs=4096 count=256000 1048576000 bytes (1.0 GB, 1000 MiB) copied, 14.394 s, 72.8 MB/s Signed-off-by: Laurent Vivier --- drivers/char/hw_random/core.c | 37 - drivers/char/hw_random/virtio-rng.c | 1 + include/linux

[PATCH] hwrng: core - Fix use-after-free warning in hwrng_register()

2019-10-14 Thread Laurent Vivier
[] (hwrng_register+0x13c/0x1b4) [] (hwrng_register) from [] (tpm_chip_register+0xc4/0x274) ... Reported-by: Marek Szyprowski Fixes: daae28debcb0 ("hwrng: core - move add_early_randomness() out of rng_mutex") Tested-by: Marek Szyprowski Signed-off-by: Laurent Vivier --- drivers/char/hw_random/c

[PATCH v2] hwrng: core - move add_early_randomness() out of rng_mutex

2019-10-11 Thread Laurent Vivier
This patch moves add_early_randomness() out of the rng_mutex zone. It only needs the reading_mutex. Signed-off-by: Laurent Vivier --- Notes: v2: in hwrng_register, take rng->ref only if rng is the new current_rng drivers/char/hw_random/core.c | 61 +--

Re: [PATCH] hw_random: move add_early_randomness() out of rng_mutex

2019-10-11 Thread Laurent Vivier
On 11/10/2019 10:45, Marek Szyprowski wrote: > Hi Laurent, > > On 12.09.2019 15:30, Laurent Vivier wrote: >> add_early_randomness() is called every time a new rng backend is added >> and every time it is set as the current rng provider. >> >> add_early_rand

Re: [PATCH] hw_random: move add_early_randomness() out of rng_mutex

2019-10-04 Thread Laurent Vivier
On 04/10/2019 16:26, Herbert Xu wrote: > On Thu, Sep 12, 2019 at 03:30:22PM +0200, Laurent Vivier wrote: >> >> @@ -496,19 +510,24 @@ int hwrng_register(struct hwrng *rng) >> goto out_unlock; >> } >> >> -if (old_rng

Re: [PATCH] hw_random: don't wait on add_early_randomness()

2019-09-17 Thread Laurent Vivier
On 17/09/2019 14:40, Herbert Xu wrote: > On Tue, Sep 17, 2019 at 11:54:50AM +0200, Laurent Vivier wrote: >> add_early_randomness() is called by hwrng_register() when the >> hardware is added. If this hardware and its module are present >> at boot, and if there is no data ava

[PATCH] hw_random: don't wait on add_early_randomness()

2019-09-17 Thread Laurent Vivier
ait=0) from add_early_randomness(). Signed-off-by: Laurent Vivier --- drivers/char/hw_random/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 9044d31ab1a1..8d53b8ef545c 100644 --- a/drivers/char/hw_r

[PATCH] hw_random: move add_early_randomness() out of rng_mutex

2019-09-12 Thread Laurent Vivier
This patch move add_early_randomness() out of the rng_mutex zone. It only needs the reading_mutex. Signed-off-by: Laurent Vivier --- drivers/char/hw_random/core.c | 60 +-- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/drivers/char/hw_random/cor