[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250415164145.00005b6f@huawei.com>
Date: Tue, 15 Apr 2025 16:41:45 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Rakie Kim <rakie.kim@...com>
CC: <akpm@...ux-foundation.org>, <gourry@...rry.net>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<joshua.hahnjy@...il.com>, <dan.j.williams@...el.com>,
<ying.huang@...ux.alibaba.com>, <david@...hat.com>, <osalvador@...e.de>,
<kernel_team@...ynix.com>, <honggyu.kim@...com>, <yunjeong.mun@...com>
Subject: Re: [PATCH v7 1/3] mm/mempolicy: Fix memory leaks in weighted
interleave sysfs
On Tue, 8 Apr 2025 16:32:40 +0900
Rakie Kim <rakie.kim@...com> wrote:
> Memory leaks occurred when removing sysfs attributes for weighted
> interleave. Improper kobject deallocation led to unreleased memory
> when initialization failed or when nodes were removed.
>
> This patch resolves the issue by replacing unnecessary `kfree()`
> calls with proper `kobject_del()` and `kobject_put()` sequences,
> ensuring correct teardown and preventing memory leaks.
>
> By explicitly calling `kobject_del()` before `kobject_put()`,
> the release function is now invoked safely, and internal sysfs
> state is correctly cleaned up. This guarantees that the memory
> associated with the kobject is fully released and avoids
> resource leaks, thereby improving system stability.
>
> Fixes: dce41f5ae253 ("mm/mempolicy: implement the sysfs-based weighted_interleave interface")
> Signed-off-by: Rakie Kim <rakie.kim@...com>
> Signed-off-by: Honggyu Kim <honggyu.kim@...com>
> Signed-off-by: Yunjeong Mun <yunjeong.mun@...com>
> Reviewed-by: Gregory Price <gourry@...rry.net>
LGTM
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Powered by blists - more mailing lists