Skip to contentSkip to conversation

SELinux: Make selinux_kernel_create_files_as() shouldn't just always return 0

PATCH In review David Howells 2 participants 2 messages Feb 26, 2010 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SELinux: Make selinux_kernel_create_files_as() shouldn't just always return 0

Make selinux_kernel_create_files_as() return an error when it gets one, rather than unconditionally returning 0.

Without this, cachefiles doesn't return an error if the SELinux policy doesn't let it create files with the label of the directory at the base of the cache.

---

 security/selinux/hooks.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
security/selinux/hooks.c +1 -1
index 9a2ee84..99a7707 100644
@@ -3334,7 +3334,7 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode)
 
 	if (ret == 0)
 		tsec->create_sid = isec->sid;
-	return 0;
+	return ret;
 }
 
 static int selinux_kernel_module_request(char *kmod_name)
#1 lore raw
Quoted 7 lines · David Howells

Make selinux_kernel_create_files_as() return an error when it gets one, rather than unconditionally returning 0.

Without this, cachefiles doesn't return an error if the SELinux policy doesn't let it create files with the label of the directory at the base of the cache.

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next

Signature · 2 lines
James Morris
<[email protected]>