diff options
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 8e42da120101..b52f923ce680 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -1934,8 +1934,7 @@ out: | |||
1934 | int security_fs_use( | 1934 | int security_fs_use( |
1935 | const char *fstype, | 1935 | const char *fstype, |
1936 | unsigned int *behavior, | 1936 | unsigned int *behavior, |
1937 | u32 *sid, | 1937 | u32 *sid) |
1938 | bool can_xattr) | ||
1939 | { | 1938 | { |
1940 | int rc = 0; | 1939 | int rc = 0; |
1941 | struct ocontext *c; | 1940 | struct ocontext *c; |
@@ -1949,7 +1948,6 @@ int security_fs_use( | |||
1949 | c = c->next; | 1948 | c = c->next; |
1950 | } | 1949 | } |
1951 | 1950 | ||
1952 | /* look for labeling behavior defined in policy */ | ||
1953 | if (c) { | 1951 | if (c) { |
1954 | *behavior = c->v.behavior; | 1952 | *behavior = c->v.behavior; |
1955 | if (!c->sid[0]) { | 1953 | if (!c->sid[0]) { |
@@ -1960,23 +1958,14 @@ int security_fs_use( | |||
1960 | goto out; | 1958 | goto out; |
1961 | } | 1959 | } |
1962 | *sid = c->sid[0]; | 1960 | *sid = c->sid[0]; |
1963 | goto out; | ||
1964 | } | ||
1965 | |||
1966 | /* labeling behavior not in policy, use xattrs if possible */ | ||
1967 | if (can_xattr) { | ||
1968 | *behavior = SECURITY_FS_USE_XATTR; | ||
1969 | *sid = SECINITSID_FS; | ||
1970 | goto out; | ||
1971 | } | ||
1972 | |||
1973 | /* no behavior in policy and can't use xattrs, try GENFS */ | ||
1974 | rc = security_genfs_sid(fstype, "/", SECCLASS_DIR, sid); | ||
1975 | if (rc) { | ||
1976 | *behavior = SECURITY_FS_USE_NONE; | ||
1977 | rc = 0; | ||
1978 | } else { | 1961 | } else { |
1979 | *behavior = SECURITY_FS_USE_GENFS; | 1962 | rc = security_genfs_sid(fstype, "/", SECCLASS_DIR, sid); |
1963 | if (rc) { | ||
1964 | *behavior = SECURITY_FS_USE_NONE; | ||
1965 | rc = 0; | ||
1966 | } else { | ||
1967 | *behavior = SECURITY_FS_USE_GENFS; | ||
1968 | } | ||
1980 | } | 1969 | } |
1981 | 1970 | ||
1982 | out: | 1971 | out: |