aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
authorMike Rapoport (Microsoft) <rppt@kernel.org>2026-05-20 11:18:56 +0300
committerPaul Moore <paul@paul-moore.com>2026-05-27 19:42:40 -0400
commit54067bacb49caeada82b20b6bd706dca0cb99ffc (patch)
treee6b7b56c2fb28701c403e725a9b74b4f71543f1b /security
parentbc3f08d1ef15ebbd32faf0b10cd9699b90b9d30c (diff)
downloadlinux-next-history-54067bacb49caeada82b20b6bd706dca0cb99ffc.tar.gz
selinux: hooks: use __getname() to allocate path buffer
selinux_genfs_get_sid() allocates memory for a path with __get_free_page() although there is a dedicated helper for allocation of file paths: __getname(). Replace __get_free_page() for allocation of a path buffer with __getname(). Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 97801966bf32c..95d0fb20d84ec 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1336,7 +1336,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
struct super_block *sb = dentry->d_sb;
char *buffer, *path;
- buffer = (char *)__get_free_page(GFP_KERNEL);
+ buffer = __getname();
if (!buffer)
return -ENOMEM;
@@ -1361,7 +1361,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
rc = 0;
}
}
- free_page((unsigned long)buffer);
+ __putname(buffer);
return rc;
}