* Re: [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type()
@ 2020-04-18 17:23 Markus Elfring
2020-04-20 1:07 ` Tiezhu Yang
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2020-04-18 17:23 UTC (permalink / raw)
To: Tiezhu Yang, linux-kselftest
Cc: linux-kernel, Luis Chamberlain, Shuah Khan, Xuefeng Li
> It should set config->test_fs instead of config->test_driver as NULL
> after kfree_const(config->test_fs) to avoid potential double free.
I suggest to improve this change description.
* How do you think about a wording variant like the following?
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.
* Would you like to add the tag “Fixes”?
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type()
2020-04-18 17:23 [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type() Markus Elfring
@ 2020-04-20 1:07 ` Tiezhu Yang
0 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2020-04-20 1:07 UTC (permalink / raw)
To: Markus Elfring, linux-kselftest
Cc: linux-kernel, Luis Chamberlain, Shuah Khan, Xuefeng Li, Andrew Morton
On 04/19/2020 01:23 AM, Markus Elfring wrote:
>> It should set config->test_fs instead of config->test_driver as NULL
>> after kfree_const(config->test_fs) to avoid potential double free.
> I suggest to improve this change description.
>
> * How do you think about a wording variant like the following?
>
> 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.
>
> * Would you like to add the tag “Fixes”?
>
> Regards,
> Markus
OK, I will send a v2 patch with the updated commit message and "Fixes" tag.
Thanks,
Tiezhu Yang
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type()
2020-04-18 5:20 ` [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type() Tiezhu Yang
@ 2020-04-18 5:47 ` Luis Chamberlain
0 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2020-04-18 5:47 UTC (permalink / raw)
To: Tiezhu Yang
Cc: Shuah Khan, linux-kselftest, linux-kernel, Xuefeng Li, Andrew Morton
On Sat, Apr 18, 2020 at 01:20:00PM +0800, Tiezhu Yang wrote:
> It should set config->test_fs instead of config->test_driver as NULL
> after kfree_const(config->test_fs) to avoid potential double free.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type()
2020-04-18 5:19 [PATCH 1/4] selftests: kmod: Use variable NAME in kmod_test_0001() Tiezhu Yang
@ 2020-04-18 5:20 ` Tiezhu Yang
2020-04-18 5:47 ` Luis Chamberlain
0 siblings, 1 reply; 4+ messages in thread
From: Tiezhu Yang @ 2020-04-18 5:20 UTC (permalink / raw)
To: Luis Chamberlain, Shuah Khan; +Cc: linux-kselftest, linux-kernel, Xuefeng Li
It should set config->test_fs instead of config->test_driver as NULL
after kfree_const(config->test_fs) to avoid potential double free.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
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 e651c37..eab5277 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.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-20 1:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 17:23 [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type() Markus Elfring
2020-04-20 1:07 ` Tiezhu Yang
-- strict thread matches above, loose matches on Subject: below --
2020-04-18 5:19 [PATCH 1/4] selftests: kmod: Use variable NAME in kmod_test_0001() Tiezhu Yang
2020-04-18 5:20 ` [PATCH 4/4] test_kmod: Avoid potential double free in trigger_config_run_type() Tiezhu Yang
2020-04-18 5: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).