From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Will Rosenberg <whrosenb@asu.edu>
Cc: Oliver Rosenberg <olrose55@gmail.com>, Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kernfs: fix memory leak of kernfs_iattrs in __kernfs_new_node
Date: Mon, 24 Nov 2025 17:15:28 +0100 [thread overview]
Message-ID: <2025112442-favorite-draw-76b0@gregkh> (raw)
In-Reply-To: <20251124160226.1921258-1-whrosenb@asu.edu>
On Mon, Nov 24, 2025 at 09:02:26AM -0700, Will Rosenberg wrote:
> There exists a memory leak of kernfs_iattrs contained as an element
> of kernfs_node allocated in __kernfs_new_node(). __kernfs_setattr()
> allocates kernfs_iattrs as a sub-object, and the LSM security check
> incorrectly errors out and does not free the kernfs_iattrs sub-object.
>
> Make an additional error out case that properly frees kernfs_iattrs if
> security_kernfs_init_security() fails.
>
> Fixes: f72dae20891d7bcc43e9263ab206960b6ae5209f ("Merge tag 'selinux-pr-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux")
Did the error really happen on a merge? That feels very wrong.
Also, please read the docs, it says how big to make that sha1 value :)
> Co-developed-by: Oliver Rosenberg <olrose55@gmail.com>
> Signed-off-by: Oliver Rosenberg <olrose55@gmail.com>
> Signed-off-by: Will Rosenberg <whrosenb@asu.edu>
> ---
> fs/kernfs/dir.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
What changed from v2?
Again, please read the kernel docs on how to submit a patch.
thanks,
greg k-h
next prev parent reply other threads:[~2025-11-24 16:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 16:02 [PATCH v2] kernfs: fix memory leak of kernfs_iattrs in __kernfs_new_node Will Rosenberg
2025-11-24 16:15 ` Greg Kroah-Hartman [this message]
2025-11-24 18:37 ` [PATCH v3] " Will Rosenberg
2025-11-24 20:41 ` Paul Moore
2025-11-25 15:11 ` Will Rosenberg
2025-11-25 15:13 ` [PATCH v4] " Will Rosenberg
2025-12-07 21:45 ` Paul Moore
2025-12-07 22:28 ` Will Rosenberg
2025-12-07 22:38 ` Paul Moore
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=2025112442-favorite-draw-76b0@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olrose55@gmail.com \
--cc=tj@kernel.org \
--cc=whrosenb@asu.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.