summaryrefslogtreecommitdiff
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 6a22eaebf3b7..e11b4b038f4a 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1362,7 +1362,8 @@ static void filename_compute_type(struct policydb *p, struct context *newcontext
u32 stype, u32 ttype, u16 tclass,
const char *objname)
{
- struct filename_trans *ft;
+ struct filename_trans ft;
+ struct filename_trans_datum *otype;
/*
* Most filename trans rules are going to live in specific directories
@@ -1372,15 +1373,14 @@ static void filename_compute_type(struct policydb *p, struct context *newcontext
if (!ebitmap_get_bit(&p->filename_trans_ttypes, ttype))
return;
- for (ft = p->filename_trans; ft; ft = ft->next) {
- if (ft->stype == stype &&
- ft->ttype == ttype &&
- ft->tclass == tclass &&
- !strcmp(ft->name, objname)) {
- newcontext->type = ft->otype;
- return;
- }
- }
+ ft.stype = stype;
+ ft.ttype = ttype;
+ ft.tclass = tclass;
+ ft.name = objname;
+
+ otype = hashtab_search(p->filename_trans, &ft);
+ if (otype)
+ newcontext->type = otype->otype;
}
static int security_compute_sid(u32 ssid,