diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 743b85ede4ef..c9e38f1ede02 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1286,6 +1286,12 @@ int security_sidtab_hash_stats(struct selinux_state *state, char *page) { int rc; + if (!state->initialized) { + pr_err("SELinux: %s: called before initial load_policy\n", + __func__); + return -EINVAL; + } + read_lock(&state->ss->policy_rwlock); rc = sidtab_hash_stats(state->ss->sidtab, page); read_unlock(&state->ss->policy_rwlock);