From: Pavel Skripkin <paskripkin@gmail.com>
To: Dongliang Mu <dzm91@hust.edu.cn>,
Ryusuke Konishi <konishi.ryusuke@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: nilfs2: fix memory leak in nilfs_sysfs_create_device_group
Date: Thu, 20 Jan 2022 17:07:35 +0300 [thread overview]
Message-ID: <0bc923d8-6565-69a3-c234-3789707efeb9@gmail.com> (raw)
In-Reply-To: <20220120134415.57147-1-dzm91@hust.edu.cn>
Hi Dongliang,
On 1/20/22 16:44, Dongliang Mu wrote:
> The preivous commit 8fd0c1b0647a ("nilfs2: fix memory leak in
> nilfs_sysfs_delete_device_group") only handles the memory leak in the
> nilfs_sysfs_delete_device_group. However, the similar memory leak still
> occurs in the nilfs_sysfs_create_device_group.
>
> Fix it by adding kobject_del when
> kobject_init_and_add succeeds, but one of the following calls fails.
>
> Fixes: 8fd0c1b0647a ("nilfs2: fix memory leak in nilfs_sysfs_delete_device_group")
Why Fixes tag points to my commit? This issue was introduced before my patch
> Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
> ---
> fs/nilfs2/sysfs.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
> index 379d22e28ed6..0b2db2b499d5 100644
> --- a/fs/nilfs2/sysfs.c
> +++ b/fs/nilfs2/sysfs.c
> @@ -995,7 +995,7 @@ int nilfs_sysfs_create_device_group(struct super_block *sb)
>
> err = nilfs_sysfs_create_mounted_snapshots_group(nilfs);
> if (err)
> - goto cleanup_dev_kobject;
> + goto delete_dev_kobject;
>
> err = nilfs_sysfs_create_checkpoints_group(nilfs);
> if (err)
> @@ -1027,6 +1027,9 @@ int nilfs_sysfs_create_device_group(struct super_block *sb)
> delete_mounted_snapshots_group:
> nilfs_sysfs_delete_mounted_snapshots_group(nilfs);
>
> +delete_dev_kobject:
> + kobject_del(&nilfs->ns_dev_kobj);
> +
> cleanup_dev_kobject:
> kobject_put(&nilfs->ns_dev_kobj);
> kfree(nilfs->ns_dev_subgroups);
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2022-01-20 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 13:44 Dongliang Mu
2022-01-20 14:07 ` Pavel Skripkin [this message]
2022-01-20 17:54 ` Ryusuke Konishi
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=0bc923d8-6565-69a3-c234-3789707efeb9@gmail.com \
--to=paskripkin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dzm91@hust.edu.cn \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
/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
all inboxes | Powered by JetHome®