lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 12 Jun 2014 10:08:10 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 1/2] tracing: Fix memory leak on failure path in ftrace_allocate_pages()

Hi Steve,

On Wed, 11 Jun 2014 10:03:40 -0400, Steven Rostedt wrote:
> On Wed, 11 Jun 2014 17:06:53 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
>
>> As struct ftrace_page is managed in a single linked list, it should
>> free from the start page.
>> 
>> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
>> ---
>>  kernel/trace/ftrace.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index 5b372e3ed675..ddfda763ded7 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -2398,7 +2398,8 @@ ftrace_allocate_pages(unsigned long num_to_init)
>>  	return start_pg;
>>  
>>   free_pages:
>> -	while (start_pg) {
>> +	pg = start_pg;
>> +	while (pg) {
>
> It works with just the added "pg = start_page", I would keep the
> while (start_pg) still.

The reason why I changed it is the code actually uses pg rather than
start_pg in the loop.  So it's more comfortable for me to check the pg
in the condition.  But it's minor, I won't insist it strongly.. :)

Thanks,
Namhyung


>>  		order = get_count_order(pg->size / ENTRIES_PER_PAGE);
>>  		free_pages((unsigned long)pg->records, order);
>>  		start_pg = pg->next;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists