Skip to contentSkip to conversation

selinux: revert use of __getname() in selinux_genfs_get_sid()

PATCH In review Paul Moore 1 participant 2 messages May 29 SELinux security module

lore
Share & tools
lore

Paul Moore

author maintainer
#0 lore raw

PATCH 1/1 selinux: revert use of __getname() in selinux_genfs_get_sid()

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.

---
 security/selinux/hooks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/hooks.c +2 -2
index 95d0fb20d84e..97801966bf32 100644
@@ -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;
 }
 
Signature · 1 line
2.54.0
author maintainer
#1 lore raw
Quoted 6 lines · Paul Moore

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.

Quoted 6 lines
---
 security/selinux/hooks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

This has been mered into selinux/dev.

Signature · 1 line
paul-moore.com