mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 06:25:52 +02:00
UPSTREAM: selinux: ensure the policy has been loaded before reading the sidtab stats
Check to make sure we have loaded a policy before we query the sidtab's hash stats. Failure to do so could result in a kernel panic/oops due to a dereferenced NULL pointer. Fixes:66f8e2f03c("selinux: sidtab reverse lookup hash table") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Paul Moore <paul@paul-moore.com> (cherry picked from commit15b590a81f) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I7e18ac17ee6c89d2a63caf02efcfb597f21f2c54
This commit is contained in:
parent
a3d2e129b7
commit
cf84a06a47
|
|
@ -1276,6 +1276,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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user