From: Salah Triki <salah.triki@gmail.com>
To: Trond Myklebust <trondmy@kernel.org>
Cc: Benjamin Coddington <bcodding@hammerspace.com>,
Anna Schumaker <anna@kernel.org>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfs: fix memory leak in nfs_sysfs_init if kset_register fails
Date: Sat, 31 Jan 2026 20:17:53 +0100 [thread overview]
Message-ID: <aX5VYbmg35vAw3IP@pc> (raw)
In-Reply-To: <6d56e691114294ed3187e7a6f281c98293393a1a.camel@kernel.org>
On Sat, Jan 31, 2026 at 11:54:06AM -0500, Trond Myklebust wrote:
>
> If you take a look at kset_register(), you'll see that it does free the
> kobj.name pointer if there is an error when adding the kobject.
>
> IOW: there is no bug in the current code.
Thanks for the clarification.
You're right, kset_register() already frees kobj.name on failure, and the
kobject is not fully initialized at that point. I double-checked the
error path in kset_register(), and the current cleanup in nfs_sysfs_init()
is correct.
Apologies for the noise — I'll drop this patch.
Thanks for taking the time to explain.
Salah
prev parent reply other threads:[~2026-01-31 19:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-31 0:09 [PATCH] nfs: fix memory leak in nfs_sysfs_init if kset_register fails Salah Triki
2026-01-31 12:21 ` Benjamin Coddington
2026-01-31 16:54 ` Trond Myklebust
2026-01-31 19:17 ` Salah Triki [this message]
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=aX5VYbmg35vAw3IP@pc \
--to=salah.triki@gmail.com \
--cc=anna@kernel.org \
--cc=bcodding@hammerspace.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@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