mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
BACKPORT: FROMGIT: [PATCH] selinux: fix handling of uninitialized selinux state in
get_bools/classes If security_get_bools/classes are called before the selinux state is initialized (i.e. before first policy load), then they should just return immediately with no booleans/classes. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Jebaitedneko <Jebaitedneko@gmail.com> Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
parent
d9022c4e5d
commit
92941cb641
@ -2831,6 +2831,13 @@ int security_get_bools(struct selinux_state *state,
|
|||||||
struct policydb *policydb;
|
struct policydb *policydb;
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
|
if (!state->initialized) {
|
||||||
|
*len = 0;
|
||||||
|
*names = NULL;
|
||||||
|
*values = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
read_lock(&state->ss->policy_rwlock);
|
read_lock(&state->ss->policy_rwlock);
|
||||||
|
|
||||||
policydb = &state->ss->policydb;
|
policydb = &state->ss->policydb;
|
||||||
@ -3164,6 +3171,12 @@ int security_get_classes(struct selinux_state *state,
|
|||||||
struct policydb *policydb = &state->ss->policydb;
|
struct policydb *policydb = &state->ss->policydb;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (!state->initialized) {
|
||||||
|
*nclasses = 0;
|
||||||
|
*classes = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
read_lock(&state->ss->policy_rwlock);
|
read_lock(&state->ss->policy_rwlock);
|
||||||
|
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user