kernel: fix sepolicy db size incorrect

This commit is contained in:
weishu
2022-12-27 15:55:54 +07:00
parent 0661dda164
commit 7b3f3d4965

View File

@@ -55,6 +55,16 @@ struct avtab_node* get_avtab_node(struct policydb* db, struct avtab_key *key, st
avdatum.u.data = key->specified == AVTAB_AUDITDENY ? ~0U : 0U;
/* this is used to get the node - insertion is actually unique */
node = avtab_insert_nonunique(&db->te_avtab, key, &avdatum);
int grow_size = sizeof(u16) * 4;
if (key->specified & AVTAB_XPERMS) {
grow_size += sizeof(u8);
grow_size += sizeof(u8);
grow_size += sizeof(u32) * ARRAY_SIZE(avdatum.u.xperms->perms.p);
} else {
grow_size += sizeof(u32) * 1;
}
db->len += grow_size;
}
return node;