summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-03-24 08:52:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:18:21 +0200
commit1f316b42a8e30ccb6524d2f3812b122f46a6e40d (patch)
tree46fcf24ca07c37b9995251d0c4e2c0bcc754c48b /lib
parent7a2ba24cee9ad56d749f364a11610e262bba9dbf (diff)
lib/test: use after free in register_test_dev_kmod()
[ Upstream commit dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_kmod.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 87a0cc750ea2..6813b183aa34 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -1155,6 +1155,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;
}