Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwrng: core - correct error check of kthread_run call

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.

Cc: stable@vger.kernel.org
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Martin Schwidefsky and committed by
Herbert Xu
17fb874d f898c522

+1 -1
+1 -1
drivers/char/hw_random/core.c
··· 429 429 static void start_khwrngd(void) 430 430 { 431 431 hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); 432 - if (hwrng_fill == ERR_PTR(-ENOMEM)) { 432 + if (IS_ERR(hwrng_fill)) { 433 433 pr_err("hwrng_fill thread creation failed"); 434 434 hwrng_fill = NULL; 435 435 }