aboutsummaryrefslogtreecommitdiffstats
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.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 03f7a4748ee..39d732145ab 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1360,14 +1360,14 @@ out:
1360 1360
1361static void filename_compute_type(struct policydb *p, struct context *newcontext, 1361static void filename_compute_type(struct policydb *p, struct context *newcontext,
1362 u32 scon, u32 tcon, u16 tclass, 1362 u32 scon, u32 tcon, u16 tclass,
1363 const struct qstr *qstr) 1363 const char *objname)
1364{ 1364{
1365 struct filename_trans *ft; 1365 struct filename_trans *ft;
1366 for (ft = p->filename_trans; ft; ft = ft->next) { 1366 for (ft = p->filename_trans; ft; ft = ft->next) {
1367 if (ft->stype == scon && 1367 if (ft->stype == scon &&
1368 ft->ttype == tcon && 1368 ft->ttype == tcon &&
1369 ft->tclass == tclass && 1369 ft->tclass == tclass &&
1370 !strcmp(ft->name, qstr->name)) { 1370 !strcmp(ft->name, objname)) {
1371 newcontext->type = ft->otype; 1371 newcontext->type = ft->otype;
1372 return; 1372 return;
1373 } 1373 }
@@ -1378,7 +1378,7 @@ static int security_compute_sid(u32 ssid,
1378 u32 tsid, 1378 u32 tsid,
1379 u16 orig_tclass, 1379 u16 orig_tclass,
1380 u32 specified, 1380 u32 specified,
1381 const struct qstr *qstr, 1381 const char *objname,
1382 u32 *out_sid, 1382 u32 *out_sid,
1383 bool kern) 1383 bool kern)
1384{ 1384{
@@ -1479,9 +1479,9 @@ static int security_compute_sid(u32 ssid,
1479 } 1479 }
1480 1480
1481 /* if we have a qstr this is a file trans check so check those rules */ 1481 /* if we have a qstr this is a file trans check so check those rules */
1482 if (qstr) 1482 if (objname)
1483 filename_compute_type(&policydb, &newcontext, scontext->type, 1483 filename_compute_type(&policydb, &newcontext, scontext->type,
1484 tcontext->type, tclass, qstr); 1484 tcontext->type, tclass, objname);
1485 1485
1486 /* Check for class-specific changes. */ 1486 /* Check for class-specific changes. */
1487 if (specified & AVTAB_TRANSITION) { 1487 if (specified & AVTAB_TRANSITION) {
@@ -1539,13 +1539,14 @@ int security_transition_sid(u32 ssid, u32 tsid, u16 tclass,
1539 const struct qstr *qstr, u32 *out_sid) 1539 const struct qstr *qstr, u32 *out_sid)
1540{ 1540{
1541 return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, 1541 return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION,
1542 qstr, out_sid, true); 1542 qstr ? qstr->name : NULL, out_sid, true);
1543} 1543}
1544 1544
1545int security_transition_sid_user(u32 ssid, u32 tsid, u16 tclass, u32 *out_sid) 1545int security_transition_sid_user(u32 ssid, u32 tsid, u16 tclass,
1546 const char *objname, u32 *out_sid)
1546{ 1547{
1547 return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, 1548 return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION,
1548 NULL, out_sid, false); 1549 objname, out_sid, false);
1549} 1550}
1550 1551
1551/** 1552/**