Skip to content

Commit

Permalink
test_kmod: avoid potential double free in trigger_config_run_type()
Browse files Browse the repository at this point in the history
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: d9c6a72 ("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]>
  • Loading branch information
Tiezhu Yang authored and torvalds committed Aug 12, 2020
1 parent 6f9e148 commit 0776d12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test_kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0776d12

Please sign in to comment.