]> Git Repo - J-linux.git/commitdiff
lib/test: use after free in register_test_dev_kmod()
authorDan Carpenter <[email protected]>
Thu, 24 Mar 2022 05:52:07 +0000 (08:52 +0300)
committerLuis Chamberlain <[email protected]>
Tue, 29 Mar 2022 22:13:36 +0000 (15:13 -0700)
The "test_dev" pointer is freed but then returned to the caller.

Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Luis Chamberlain <[email protected]>
lib/test_kmod.c

index ce15893914131efd5723737bb34b5f0bf62af4fb..cb800b1d0d99c0d77ffeaae4d9e32adbceb756e4 100644 (file)
@@ -1149,6 +1149,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)
        if (ret) {
                pr_err("could not register misc device: %d\n", ret);
                free_test_dev_kmod(test_dev);
+               test_dev = NULL;
                goto out;
        }
 
This page took 0.056689 seconds and 4 git commands to generate.