Patch "kunit: bail out early in __kunit_test_suites_init() if there are no suites to test" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kunit: bail out early in __kunit_test_suites_init() if there are no suites to test

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kunit-bail-out-early-in-__kunit_test_suites_init-if-.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c6d41d736820d60c7bc1df7c59551a85d667a2ad
Author: Scott Mayhew <smayhew@xxxxxxxxxx>
Date:   Thu Mar 21 10:32:00 2024 -0400

    kunit: bail out early in __kunit_test_suites_init() if there are no suites to test
    
    [ Upstream commit 5496b9b77d7420652202b73cf036e69760be5deb ]
    
    Commit c72a870926c2 added a mutex to prevent kunit tests from running
    concurrently.  Unfortunately that mutex gets locked during module load
    regardless of whether the module actually has any kunit tests.  This
    causes a problem for kunit tests that might need to load other kernel
    modules (e.g. gss_krb5_test loading the camellia module).
    
    So check to see if there are actually any tests to run before locking
    the kunit_run_lock mutex.
    
    Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs")
    Reported-by: Nico Pache <npache@xxxxxxxxxx>
    Signed-off-by: Scott Mayhew <smayhew@xxxxxxxxxx>
    Reviewed-by: Rae Moar <rmoar@xxxxxxxxxx>
    Reviewed-by: David Gow <davidgow@xxxxxxxxxx>
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 1d1475578515c..b8514dbb337c0 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_
 {
 	unsigned int i;
 
+	if (num_suites == 0)
+		return 0;
+
 	if (!kunit_enabled() && num_suites > 0) {
 		pr_info("kunit: disabled\n");
 		return 0;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux