提交 a3c37ea8 编写于 作者: D Dan Carpenter 提交者: Zheng Zengkai

lib/test: use after free in register_test_dev_kmod()

stable inclusion
from stable-v5.10.110
commit 327f07e3704c821ce33e54ef5046bdf69975cb86
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=327f07e3704c821ce33e54ef5046bdf69975cb86

--------------------------------

[ Upstream commit dc0ce6cc ]

The "test_dev" pointer is freed but then returned to the caller.

Fixes: d9c6a72d ("kmod: add test driver to stress test the module loader")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 10fcb826
...@@ -1155,6 +1155,7 @@ static struct kmod_test_device *register_test_dev_kmod(void) ...@@ -1155,6 +1155,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)
if (ret) { if (ret) {
pr_err("could not register misc device: %d\n", ret); pr_err("could not register misc device: %d\n", ret);
free_test_dev_kmod(test_dev); free_test_dev_kmod(test_dev);
test_dev = NULL;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册