Re: [PATCH] mm/damon/reclaim: fix potential memory leak in damon_reclaim_init()

From: SeongJae Park
Date: Thu Jul 14 2022 - 13:43:26 EST


Hello Jianglei,

On Thu, 14 Jul 2022 16:44:27 +0000 SeongJae Park <sj@xxxxxxxxxx> wrote:

> Hello Jianglei,
>
> On Thu, 14 Jul 2022 14:37:46 +0800 Jianglei Nie <niejianglei2021@xxxxxxx> wrote:
>
> > damon_reclaim_init() allocates a memory chunk for ctx with
> > damon_new_ctx(). When damon_select_ops() fails, ctx is not released, which
> > will lead to a memory leak.

I realized this issue is also in DAMON_LRU_SORT, so posted a patch:
https://lore.kernel.org/damon/20220714170458.49727-1-sj@xxxxxxxxxx/

I mistakenly forgot CC-ing you, so letting you know here.


Thanks,
SJ