aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-08-24 15:59:07 -0400
committerEric Paris <eparis@redhat.com>2013-07-25 13:03:21 -0400
commita64c54cf0811b8032fdab8c9d52576f0370837fa (patch)
tree2fb17477db2ba91fb2043ece739a898f369b1b36 /security/selinux/ss/services.c
parent308ab70c465d97cf7e3168961dfd365535de21a6 (diff)
SELinux: pass a superblock to security_fs_use
Rather than passing pointers to memory locations, strings, and other stuff just give up on the separation and give security_fs_use the superblock. It just makes the code easier to read (even if not easier to reuse on some other OS) Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 603c638434bb..a90721771615 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2323,17 +2323,14 @@ out:
2323 2323
2324/** 2324/**
2325 * security_fs_use - Determine how to handle labeling for a filesystem. 2325 * security_fs_use - Determine how to handle labeling for a filesystem.
2326 * @fstype: filesystem type 2326 * @sb: superblock in question
2327 * @behavior: labeling behavior
2328 * @sid: SID for filesystem (superblock)
2329 */ 2327 */
2330int security_fs_use( 2328int security_fs_use(struct super_block *sb)
2331 const char *fstype,
2332 short unsigned int *behavior,
2333 u32 *sid)
2334{ 2329{
2335 int rc = 0; 2330 int rc = 0;
2336 struct ocontext *c; 2331 struct ocontext *c;
2332 struct superblock_security_struct *sbsec = sb->s_security;
2333 const char *fstype = sb->s_type->name;
2337 2334
2338 read_lock(&policy_rwlock); 2335 read_lock(&policy_rwlock);
2339 2336
@@ -2345,21 +2342,21 @@ int security_fs_use(
2345 } 2342 }
2346 2343
2347 if (c) { 2344 if (c) {
2348 *behavior = c->v.behavior; 2345 sbsec->behavior = c->v.behavior;
2349 if (!c->sid[0]) { 2346 if (!c->sid[0]) {
2350 rc = sidtab_context_to_sid(&sidtab, &c->context[0], 2347 rc = sidtab_context_to_sid(&sidtab, &c->context[0],
2351 &c->sid[0]); 2348 &c->sid[0]);
2352 if (rc) 2349 if (rc)
2353 goto out; 2350 goto out;
2354 } 2351 }
2355 *sid = c->sid[0]; 2352 sbsec->sid = c->sid[0];
2356 } else { 2353 } else {
2357 rc = security_genfs_sid(fstype, "/", SECCLASS_DIR, sid); 2354 rc = security_genfs_sid(fstype, "/", SECCLASS_DIR, &sbsec->sid);
2358 if (rc) { 2355 if (rc) {
2359 *behavior = SECURITY_FS_USE_NONE; 2356 sbsec->behavior = SECURITY_FS_USE_NONE;
2360 rc = 0; 2357 rc = 0;
2361 } else { 2358 } else {
2362 *behavior = SECURITY_FS_USE_GENFS; 2359 sbsec->behavior = SECURITY_FS_USE_GENFS;
2363 } 2360 }
2364 } 2361 }
2365 2362