Skip to content

Commit 8dc5145

Browse files
cgzonespcmoore
authored andcommitted
selinux: annotate intentional data race in inode_doinit_with_dentry()
Like other `isec->initialized == LABEL_INITIALIZED` checks annotate the check in inode_doinit_with_dentry() with data_race to please KCSAN. The value is rechecked next with lock held. Reported-by: syzbot+9ab96b38b76bec93939a@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9ab96b38b76bec93939a Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 6de23f8 commit 8dc5145

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

security/selinux/hooks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
14361436
struct dentry *dentry;
14371437
int rc = 0;
14381438

1439-
if (isec->initialized == LABEL_INITIALIZED)
1439+
/* check below is racy, but we will recheck with lock held */
1440+
if (data_race(isec->initialized == LABEL_INITIALIZED))
14401441
return 0;
14411442

14421443
spin_lock(&isec->lock);

0 commit comments

Comments
 (0)