From: Tiezhu Yang <yangtie...@loongson.cn>

[ Upstream commit 0776d1231bec0c7ab43baf440a3f5ef5f49dd795 ]

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 <yangtie...@loongson.cn>
Signed-off-by: Luis Chamberlain <mcg...@kernel.org>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Acked-by: Luis Chamberlain <mcg...@kernel.org>
Cc: Alexei Starovoitov <a...@kernel.org>
Cc: Al Viro <v...@zeniv.linux.org.uk>
Cc: Christian Brauner <christian.brau...@ubuntu.com>
Cc: Chuck Lever <chuck.le...@oracle.com>
Cc: David Howells <dhowe...@redhat.com>
Cc: David S. Miller <da...@davemloft.net>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Jakub Kicinski <k...@kernel.org>
Cc: James Morris <jmor...@namei.org>
Cc: Jarkko Sakkinen <jarkko.sakki...@linux.intel.com>
Cc: J. Bruce Fields <bfie...@fieldses.org>
Cc: Jens Axboe <ax...@kernel.dk>
Cc: Josh Triplett <j...@joshtriplett.org>
Cc: Kees Cook <keesc...@chromium.org>
Cc: Lars Ellenberg <lars.ellenb...@linbit.com>
Cc: Nikolay Aleksandrov <niko...@cumulusnetworks.com>
Cc: Philipp Reisner <philipp.reis...@linbit.com>
Cc: Roopa Prabhu <ro...@cumulusnetworks.com>
Cc: "Serge E. Hallyn" <se...@hallyn.com>
Cc: Sergei Trofimovich <sly...@gentoo.org>
Cc: Sergey Kvachonok <raven...@gmail.com>
Cc: Shuah Khan <sh...@kernel.org>
Cc: Tony Vroon <chain...@gentoo.org>
Cc: Christoph Hellwig <h...@infradead.org>
Link: http://lkml.kernel.org/r/20200610154923.27510-4-mcg...@kernel.org
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 lib/test_kmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 9cf77628fc913..87a0cc750ea23 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;
-- 
2.25.1



Reply via email to