diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-03-24 08:52:07 +0300 |
---|---|---|
committer | Luis Chamberlain <mcgrof@kernel.org> | 2022-03-30 01:13:36 +0300 |
commit | dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c (patch) | |
tree | 7024d31e752882c83c16d1460cd7942d5e513c44 | |
parent | 13776ebb9964b2ea66ffb8c824c0762eed6da784 (diff) | |
download | linux-dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c.tar.xz |
lib/test: use after free in register_test_dev_kmod()
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 <dan.carpenter@oracle.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
-rw-r--r-- | lib/test_kmod.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/test_kmod.c b/lib/test_kmod.c index ce1589391413..cb800b1d0d99 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -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; } |