Commit 640e6017 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Greg Kroah-Hartman

hwrng: core - correct error check of kthread_run call

commit 17fb874d upstream.

The kthread_run() function can return two different error values
but the hwrng core only checks for -ENOMEM. If the other error
value -EINTR is returned it is assigned to hwrng_fill and later
used on a kthread_stop() call which naturally crashes.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f90781aa
...@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused) ...@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused)
static void start_khwrngd(void) static void start_khwrngd(void)
{ {
hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
if (hwrng_fill == ERR_PTR(-ENOMEM)) { if (IS_ERR(hwrng_fill)) {
pr_err("hwrng_fill thread creation failed"); pr_err("hwrng_fill thread creation failed");
hwrng_fill = NULL; hwrng_fill = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment