* [PATCH] lib/test_kmod: Potential double free in error handling
@ 2019-01-21 14:00 Dan Carpenter
2019-01-22 19:47 ` Luis Chamberlain
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-01-21 14:00 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: linux-kernel, kernel-janitors
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: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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 d82d022111e0..9cf77628fc91 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -632,7 +632,7 @@ static void __kmod_config_free(struct test_config *config)
config->test_driver = NULL;
kfree_const(config->test_fs);
- config->test_driver = NULL;
+ config->test_fs = NULL;
}
static void kmod_config_free(struct kmod_test_device *test_dev)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/test_kmod: Potential double free in error handling
2019-01-21 14:00 [PATCH] lib/test_kmod: Potential double free in error handling Dan Carpenter
@ 2019-01-22 19:47 ` Luis Chamberlain
0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2019-01-22 19:47 UTC (permalink / raw)
To: Dan Carpenter, akpm; +Cc: linux-kernel, kernel-janitors
On Mon, Jan 21, 2019 at 05:00:11PM +0300, Dan Carpenter wrote:
> 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: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks!
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-22 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 14:00 [PATCH] lib/test_kmod: Potential double free in error handling Dan Carpenter
2019-01-22 19:47 ` Luis Chamberlain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).