lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aSXHLOdujmeUDELo@gmail.com>
Date: Tue, 25 Nov 2025 08:11:40 -0700
From: Will Rosenberg <whrosenb@....edu>
To: Paul Moore <paul@...l-moore.com>
Cc: Oliver Rosenberg <olrose55@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Tejun Heo <tj@...nel.org>, Casey Schaufler <casey@...aufler-ca.com>,
	Ondrej Mosnacek <omosnace@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] kernfs: fix memory leak of kernfs_iattrs in
 __kernfs_new_node

On Mon, Nov 24, 2025 at 03:41:51PM -0500, Paul Moore wrote:
>
> Should this be kmem_cache_free(kernfs_iattrs_cache, kn->iattr)
> instead?  I suspect it would also probably be a good idea to call
> simple_xattrs_free() first.
>
> I also noticed there is a reasonable amount of duplicated kernfs
> cleanup code spread around fs/kernfs/dir.c, we could probably benefit
> from some helper functions here, but that would be a follow-on patch;
> keeping a small bugfix patch to ease stable tree backporting is a good
> thing.

I agree. Helper functions could also help prevent this type of bug from
re-emerging.

> [HINT FOR THE FUTURE: for patches like this, look for a function that
> normally does resource cleanup for the object and do what it does, in
> this case kernfs_free_rcu() is a good example.]

Thank you for all the help. I updated kfree to kmem_cache_free() and
added simple_xattrs_free() just to be safe for future changes.

--
will rosenberg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ