diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-03-24 08:52:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-08 15:40:30 +0300 |
commit | 327f07e3704c821ce33e54ef5046bdf69975cb86 (patch) | |
tree | b0583171d50df6b294055ee23c92eca8b11f09af /lib/test_kmod.c | |
parent | 00d2b9fe5e02b41c6e4d7a4c1171cc6dd3008617 (diff) | |
download | linux-327f07e3704c821ce33e54ef5046bdf69975cb86.tar.xz |
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/test_kmod.c')
-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 eab52770070d..c637f6b5053a 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; } |