Skip to content

Commit cde5e1b

Browse files
l0kodshuahkh
authored andcommitted
kunit: Handle thread creation error
Previously, if a thread creation failed (e.g. -ENOMEM), the function was called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without marking the test as failed. Instead, fill try_result with the error code returned by kthread_run(), which will mark the test as failed and print "internal error occurred...". Cc: Brendan Higgins <[email protected]> Cc: Shuah Khan <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Rae Moar <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Mickaël Salaün <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Shuah Khan <[email protected]>
1 parent dd5a440 commit cde5e1b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/kunit/try-catch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
6969
try_catch,
7070
"kunit_try_catch_thread");
7171
if (IS_ERR(task_struct)) {
72+
try_catch->try_result = PTR_ERR(task_struct);
7273
try_catch->catch(try_catch->context);
7374
return;
7475
}

0 commit comments

Comments
 (0)