]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selinux: revert use of __getname() in selinux_genfs_get_sid()
authorPaul Moore <paul@paul-moore.com>
Fri, 29 May 2026 15:24:37 +0000 (11:24 -0400)
committerPaul Moore <paul@paul-moore.com>
Fri, 29 May 2026 15:24:37 +0000 (11:24 -0400)
Revert commit 54067bacb49c ("selinux: hooks: use __getname() to allocate
path buffer") as it improperly assumed that PATH_MAX == PAGE_SIZE
everywhere.  Moving away from __get_free_page() is still a good thing and
will be revisited in the future.

Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c

index 95d0fb20d84ec38d8a714d553193ddc39c8b74b9..97801966bf32c23383a5e3775a030a03f23e5f86 100644 (file)
@@ -1336,7 +1336,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
        struct super_block *sb = dentry->d_sb;
        char *buffer, *path;
 
-       buffer = __getname();
+       buffer = (char *)__get_free_page(GFP_KERNEL);
        if (!buffer)
                return -ENOMEM;
 
@@ -1361,7 +1361,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
                        rc = 0;
                }
        }
-       __putname(buffer);
+       free_page((unsigned long)buffer);
        return rc;
 }