Skip to content

Commit db7ddea

Browse files
Dan Carpentertorvalds
authored andcommitted
lib/test_kmod.c: potential double free in error handling
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: d9c6a72 ("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>
1 parent cefc7ef commit db7ddea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/test_kmod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static void __kmod_config_free(struct test_config *config)
632632
config->test_driver = NULL;
633633

634634
kfree_const(config->test_fs);
635-
config->test_driver = NULL;
635+
config->test_fs = NULL;
636636
}
637637

638638
static void kmod_config_free(struct kmod_test_device *test_dev)

0 commit comments

Comments
 (0)