aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiezhu Yang <[email protected]>2020-08-11 18:36:16 -0700
committerLinus Torvalds <[email protected]>2020-08-12 10:58:01 -0700
commit0776d1231bec0c7ab43baf440a3f5ef5f49dd795 (patch)
treed768fc3fa581809387cfba3c136d74b568d0ae36
parent6f9e148c218641ad876845abdea4b0597468c55e (diff)
test_kmod: avoid potential double free in trigger_config_run_type()
Reset the member "test_fs" of the test configuration after a call of the function "kfree_const" to a null pointer so that a double memory release will not be performed. Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader") Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Luis Chamberlain <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Al Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Chuck Lever <[email protected]> Cc: David Howells <[email protected]> Cc: David S. Miller <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: James Morris <[email protected]> Cc: Jarkko Sakkinen <[email protected]> Cc: J. Bruce Fields <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Kees Cook <[email protected]> Cc: Lars Ellenberg <[email protected]> Cc: Nikolay Aleksandrov <[email protected]> Cc: Philipp Reisner <[email protected]> Cc: Roopa Prabhu <[email protected]> Cc: "Serge E. Hallyn" <[email protected]> Cc: Sergei Trofimovich <[email protected]> Cc: Sergey Kvachonok <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Tony Vroon <[email protected]> Cc: Christoph Hellwig <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
-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 e651c37d56db..eab52770070d 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -745,7 +745,7 @@ static int trigger_config_run_type(struct kmod_test_device *test_dev,
break;
case TEST_KMOD_FS_TYPE:
kfree_const(config->test_fs);
- config->test_driver = NULL;
+ config->test_fs = NULL;
copied = config_copy_test_fs(config, test_str,
strlen(test_str));
break;