浏览代码

SELinux: skip file_name_trans_write() when policy downgraded.

When policy version is less than POLICYDB_VERSION_FILENAME_TRANS,
skip file_name_trans_write().

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Roy.Li 14 年之前
父节点
当前提交
ded509880f
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      security/selinux/ss/policydb.c

+ 3 - 0
security/selinux/ss/policydb.c

@@ -3222,6 +3222,9 @@ static int filename_trans_write(struct policydb *p, void *fp)
 	__le32 buf[1];
 	__le32 buf[1];
 	int rc;
 	int rc;
 
 
+	if (p->policyvers < POLICYDB_VERSION_FILENAME_TRANS)
+		return 0;
+
 	nel = 0;
 	nel = 0;
 	rc = hashtab_map(p->filename_trans, hashtab_cnt, &nel);
 	rc = hashtab_map(p->filename_trans, hashtab_cnt, &nel);
 	if (rc)
 	if (rc)