提交 b7f3008a 编写于 作者: S Stephen Smalley 提交者: James Morris

SELinux: fix locking issue introduced with c6d3aaa4

Ensure that we release the policy read lock on all exit paths from
security_compute_av.
Signed-off-by: NStephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 825332e4
...@@ -935,19 +935,22 @@ int security_compute_av(u32 ssid, ...@@ -935,19 +935,22 @@ int security_compute_av(u32 ssid,
u32 requested; u32 requested;
int rc; int rc;
read_lock(&policy_rwlock);
if (!ss_initialized) if (!ss_initialized)
goto allow; goto allow;
read_lock(&policy_rwlock);
requested = unmap_perm(orig_tclass, orig_requested); requested = unmap_perm(orig_tclass, orig_requested);
tclass = unmap_class(orig_tclass); tclass = unmap_class(orig_tclass);
if (unlikely(orig_tclass && !tclass)) { if (unlikely(orig_tclass && !tclass)) {
if (policydb.allow_unknown) if (policydb.allow_unknown)
goto allow; goto allow;
return -EINVAL; rc = -EINVAL;
goto out;
} }
rc = security_compute_av_core(ssid, tsid, tclass, requested, avd); rc = security_compute_av_core(ssid, tsid, tclass, requested, avd);
map_decision(orig_tclass, avd, policydb.allow_unknown); map_decision(orig_tclass, avd, policydb.allow_unknown);
out:
read_unlock(&policy_rwlock); read_unlock(&policy_rwlock);
return rc; return rc;
allow: allow:
...@@ -956,7 +959,8 @@ int security_compute_av(u32 ssid, ...@@ -956,7 +959,8 @@ int security_compute_av(u32 ssid,
avd->auditdeny = 0xffffffff; avd->auditdeny = 0xffffffff;
avd->seqno = latest_granting; avd->seqno = latest_granting;
avd->flags = 0; avd->flags = 0;
return 0; rc = 0;
goto out;
} }
int security_compute_av_user(u32 ssid, int security_compute_av_user(u32 ssid,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册