From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: "Luis R. Rodriguez" Message-Id: <20200610154923.27510-4-mcgrof@kernel.org> In-Reply-To: <20200610154923.27510-1-mcgrof@kernel.org> References: <20200610154923.27510-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Bridge] [PATCH 3/5] test_kmod: Avoid potential double free in trigger_config_run_type() List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Wed, 10 Jun 2020 15:49:28 -0000 To: gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, axboe@kernel.dk, bfields@fieldses.org, chuck.lever@oracle.com, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, davem@davemloft.net, kuba@kernel.org, dhowells@redhat.com, jarkko.sakkinen@linux.intel.com, jmorris@namei.org, serge@hallyn.com, christian.brauner@ubuntu.com Cc: linux-nfs@vger.kernel.org, chainsaw@gentoo.org, ravenexp@gmail.com, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, josh@joshtriplett.org, slyfox@gentoo.org, ast@kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, Luis Chamberlain , linux-fsdevel@vger.kernel.org, Tiezhu Yang , keescook@chromium.org From: Tiezhu Yang 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") Acked-by: Luis Chamberlain Signed-off-by: Tiezhu Yang Signed-off-by: Luis Chamberlain --- 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 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; -- 2.26.2