Skip to content

Commit 06776df

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubifs: dbg_orphan_check: Fix missed key type checking
When selinux/encryption is enabled, xattr entry node is added into TNC before host inode when creating new file. So it is possible to find xattr entry without host inode from TNC. Orphan debug checking is called by ubifs_orphan_end_commit(), at that time, the commit semaphore is already unlock, so the new creation won't be blocked. Fixes: d7f0b70 ("UBIFS: Add security.* XATTR support for the UBIFS") Fixes: d475a50 ("ubifs: Add skeleton for fscrypto") Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 3af2d3a commit 06776df

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/ubifs/orphan.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,12 @@ static int dbg_orphan_check(struct ubifs_info *c, struct ubifs_zbranch *zbr,
816816

817817
inum = key_inum(c, &zbr->key);
818818
if (inum != ci->last_ino) {
819-
/* Lowest node type is the inode node, so it comes first */
820-
if (key_type(c, &zbr->key) != UBIFS_INO_KEY)
819+
/*
820+
* Lowest node type is the inode node or xattr entry(when
821+
* selinux/encryption is enabled), so it comes first
822+
*/
823+
if (key_type(c, &zbr->key) != UBIFS_INO_KEY &&
824+
key_type(c, &zbr->key) != UBIFS_XENT_KEY)
821825
ubifs_err(c, "found orphan node ino %lu, type %d",
822826
(unsigned long)inum, key_type(c, &zbr->key));
823827
ci->last_ino = inum;

0 commit comments

Comments
 (0)