Commit 8d5b2555 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

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

Fixes: d9c6a72d ("kmod: add test driver to stress test the module loader")
Signed-off-by: default avatarDan Carpenter <>
Acked-by: default avatarLuis Chamberlain <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
Signed-off-by: default avatarSasha Levin <>
parent d83382c6
......@@ -632,7 +632,7 @@ static void __kmod_config_free(struct test_config *config)
config->test_driver = NULL;
config->test_driver = NULL;
config->test_fs = NULL;
static void kmod_config_free(struct kmod_test_device *test_dev)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment