From: zijun_hu <zijun_hu@zoho.com>
To: Tejun Heo <tj@kernel.org>
Cc: zijun_hu@htc.com, Andrew Morton <akpm@linux-foundation.org>,
cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] mm/percpu.c: fix potential memory leakage for pcpu_embed_first_chunk()
Date: Fri, 30 Sep 2016 17:32:36 +0800 [thread overview]
Message-ID: <cfeaa6dc-16b8-f090-bb2f-531441be4341@zoho.com> (raw)
In-Reply-To: <20160930084323.GC29207@mtj.duckdns.org>
On 2016/9/30 16:43, Tejun Heo wrote:
> Hello,
>
> On Fri, Sep 30, 2016 at 01:38:35AM +0800, zijun_hu wrote:
>> 1) the simpler way don't work because it maybe free many memory block twice
>
> Right, the punched holes. Forgot about them. Yeah, that's why the
> later failure just leaks memory.
>
>> 2) as we seen, pcpu_setup_first_chunk() doesn't cause a failure, it return 0
>> always or panic by BUG_ON(), even if it fails, we can conclude the allocated
>> memory based on information recorded by it, such as pcpu_base_addr and many of
>> static variable, we can complete the free operations; but we can't if we
>> fail in the case pointed by this patch
>
> So, being strictly correct doesn't matter that much here. These
> things failing indicates that something is very wrong with either the
> code or configuration and we might as well trigger BUG. That said,
> yeah, it's nicer to recover without leaking anything.
>
>> 3) my test way is simple, i force "if (max_distance > VMALLOC_TOTAL * 3 / 4)"
>> to if (1) and print which memory i allocate before the jumping, then print which memory
>> i free after the jumping and before returning, then check whether i free the memory i
>> allocate in this function, the result is okay
>
> Can you please include what has been discussed into the patch
> description?
>
> Thanks.
>
okayi 1/4 ? no problem
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2016-09-30 9:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 16:03 [RFC PATCH 1/1] mm/percpu.c: fix potential memory leakage for pcpu_embed_first_chunk() zijun_hu
2016-09-29 16:44 ` Tejun Heo
2016-09-29 17:38 ` zijun_hu
2016-09-30 8:43 ` Tejun Heo
2016-09-30 9:32 ` zijun_hu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cfeaa6dc-16b8-f090-bb2f-531441be4341@zoho.com \
--to=zijun_hu@zoho.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.org \
--cc=zijun_hu@htc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).