[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230330165248.rv7bssd6ys6m33od@google.com>
Date: Thu, 30 Mar 2023 16:52:48 +0000
From: Shakeel Butt <shakeelb@...gle.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Marek Szyprowski <m.szyprowski@...sung.com>,
linux-mm@...ck.org, stable@...r.kernel.org
Subject: Re: [PATCH 1/1] mm: Fix memory leak on mm_init error handling
On Thu, Mar 30, 2023 at 09:38:22AM -0400, Mathieu Desnoyers wrote:
> commit f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter")
> introduces a memory leak by missing a call to destroy_context() when a
> percpu_counter fails to allocate.
>
> Before introducing the per-cpu counter allocations, init_new_context()
> was the last call that could fail in mm_init(), and thus there was no
> need to ever invoke destroy_context() in the error paths. Adding the
> following percpu counter allocations adds error paths after
> init_new_context(), which means its associated destroy_context() needs
> to be called when percpu counters fail to allocate.
>
Fixes: f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter")
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Shakeel Butt <shakeelb@...gle.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Marek Szyprowski <m.szyprowski@...sung.com>
> Cc: linux-mm@...ck.org
> Cc: stable@...r.kernel.org # 6.2
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists