Skip to content

Commit 17fb874

Browse files
Martin Schwidefskyherbertx
Martin Schwidefsky
authored andcommitted
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: [email protected] Signed-off-by: Martin Schwidefsky <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent f898c52 commit 17fb874

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/hw_random/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused)
429429
static void start_khwrngd(void)
430430
{
431431
hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
432-
if (hwrng_fill == ERR_PTR(-ENOMEM)) {
432+
if (IS_ERR(hwrng_fill)) {
433433
pr_err("hwrng_fill thread creation failed");
434434
hwrng_fill = NULL;
435435
}

0 commit comments

Comments
 (0)