From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: [PATCH AUTOSEL 5.14 25/25] nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group Date: Mon, 13 Sep 2021 18:33:39 -0400 Message-ID: <20210913223339.435347-25-sashal@kernel.org> References: <20210913223339.435347-1-sashal@kernel.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631572454; bh=KwiaTbPmsT4YO8Qo3dXcfQ3TTwgw1wvyf3TZaJv1R7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=olJ1Bzh2c1sybXFz2G6nlRjcsvPIiCdlNRzk45ylrRWpcBtXweT+Nk/0ANRNYJvJ5 0AZan+3GstV7HWEnHWgdaR5MeuZ7VV2Z9sy3Qz3fuI02tPze9QULfmgcQ7j5Wad5lH sv7uEZ9+ATEno7iM4lALmQp5OcKn4t0rXLZdOnixkVXnqU/be23C0uGG6ZvShUOr03 QZwhF1qOYh+8+lsrfwIEUxBqIps7EAYGm1/zElgk00322w4JbC8/9J7ZRik1+4qcG8 hOAnXFqvPxYQW9wZPgJVjgU/rP+B0Eq8Ni23t7pexA0UEkWPFWQim0DqfLEzxpQYgJ wFgBblBcgBpZQ== In-Reply-To: <20210913223339.435347-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Nanyong Sun , Ryusuke Konishi , Andrew Morton , Linus Torvalds , Sasha Levin , linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org From: Nanyong Sun [ Upstream commit 17243e1c3072b8417a5ebfc53065d0a87af7ca77 ] kobject_put() should be used to cleanup the memory associated with the kobject instead of kobject_del(). See the section "Kobject removal" of "Documentation/core-api/kobject.rst". Link: https://lkml.kernel.org/r/20210629022556.3985106-7-sunnanyong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org Link: https://lkml.kernel.org/r/1625651306-10829-7-git-send-email-konishi.ryusuke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Signed-off-by: Nanyong Sun Signed-off-by: Ryusuke Konishi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/nilfs2/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c index 5ba87573ad3b..62f8a7ac19c8 100644 --- a/fs/nilfs2/sysfs.c +++ b/fs/nilfs2/sysfs.c @@ -202,7 +202,7 @@ int nilfs_sysfs_create_snapshot_group(struct nilfs_root *root) void nilfs_sysfs_delete_snapshot_group(struct nilfs_root *root) { - kobject_del(&root->snapshot_kobj); + kobject_put(&root->snapshot_kobj); } /************************************************************************ -- 2.30.2