Skip to content

Commit

Permalink
kcsan: test: Defer kcsan_test_init() after kunit initialization
Browse files Browse the repository at this point in the history
When the test is built into the kernel (not a module), kcsan_test_init()
and kunit_init() both use late_initcall(), which means kcsan_test_init()
might see a NULL debugfs_rootdir as parent dentry, resulting in
kcsan_test_init() and kcsan_debugfs_init() both trying to create a
debugfs node named "kcsan" in debugfs root. One of them will show an
error and be unsuccessful.

Defer kcsan_test_init() until we're sure kunit was initialized.

Signed-off-by: Marco Elver <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
  • Loading branch information
melver authored and paulmckrcu committed Sep 13, 2021
1 parent 6880fa6 commit e807042
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/kcsan/kcsan_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ static void kcsan_test_exit(void)
tracepoint_synchronize_unregister();
}

late_initcall(kcsan_test_init);
late_initcall_sync(kcsan_test_init);
module_exit(kcsan_test_exit);

MODULE_LICENSE("GPL v2");
Expand Down

0 comments on commit e807042

Please sign in to comment.