[PATCH v2] securityfs: fix missing of d_delete() in securityfs_remove()
Al Viro
viro at zeniv.linux.org.uk
Wed May 7 21:23:29 UTC 2025
On Wed, May 07, 2025 at 04:10:11PM -0400, Paul Moore wrote:
> > In addition, securityfs_recursive_remove() avoids this problem by calling
> > __d_drop() directly. As a non-recursive version, it is somewhat strange
> > that securityfs_remove() does not clean up the deleted dentry.
> >
> > Fix this by adding d_delete() in securityfs_remove().
>
> I wondering why we don't simply replace all instances of
> securityfs_remove() with securityfs_recursive_remove(), or more likely
> just remove the existing securityfs_remove() and rename the
> securityfs_recursive_remove() to securityfs_remove(). Do any existing
> LSMs rely on securityfs_remove() *not* acting recursively?
It's a bit trickier than that (there are interesting issues around
efi_secret_unlink() nonsense, as well as insane refcounting grabbing
two references where only one is needed to pin the damn thing)...
More information about the Linux-security-module-archive
mailing list