summaryrefslogtreecommitdiffstats
path: root/lib/test_kmod.c
diff options
context:
space:
mode:
authorDan Carpenter2019-02-01 23:20:58 +0100
committerGreg Kroah-Hartman2019-03-13 22:02:32 +0100
commitf1524fd049dec225ca8ae5585fced14359f348e6 (patch)
tree8ee743a82b7c9c915b0076d5d58c7f06fe8be5df /lib/test_kmod.c
parentmm, memory_hotplug: test_pages_in_a_zone do not pass the end of zone (diff)
downloadkernel-qcow2-linux-f1524fd049dec225ca8ae5585fced14359f348e6.tar.gz
kernel-qcow2-linux-f1524fd049dec225ca8ae5585fced14359f348e6.tar.xz
kernel-qcow2-linux-f1524fd049dec225ca8ae5585fced14359f348e6.zip
lib/test_kmod.c: potential double free in error handling
[ Upstream commit db7ddeab3ce5d64c9696e70d61f45ea9909cd196 ] There is a copy and paste bug so we set "config->test_driver" to NULL twice instead of setting "config->test_fs". Smatch complains that it leads to a double free: lib/test_kmod.c:840 __kmod_config_init() warn: 'config->test_fs' double freed Link: http://lkml.kernel.org/r/20190121140011.GA14283@kadam Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib/test_kmod.c')
-rw-r--r--lib/test_kmod.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index d82d022111e0..9cf77628fc91 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -632,7 +632,7 @@ static void __kmod_config_free(struct test_config *config)
config->test_driver = NULL;
kfree_const(config->test_fs);
- config->test_driver = NULL;
+ config->test_fs = NULL;
}
static void kmod_config_free(struct kmod_test_device *test_dev)