summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2026-02-02 16:48:03 +0300
committerPaul Moore <paul@paul-moore.com>2026-02-23 19:14:29 +0300
commit8dc51459ef702bcc0ef5fb26bb4d362b38aa56c2 (patch)
treee3f6a3afb1bec35fb3145ee0ddc6b680ab354f6a
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f (diff)
downloadlinux-8dc51459ef702bcc0ef5fb26bb4d362b38aa56c2.tar.xz
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>
-rw-r--r--security/selinux/hooks.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d8224ea113d1..6ef9c1aade65 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1436,7 +1436,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
struct dentry *dentry;
int rc = 0;
- if (isec->initialized == LABEL_INITIALIZED)
+ /* check below is racy, but we will recheck with lock held */
+ if (data_race(isec->initialized == LABEL_INITIALIZED))
return 0;
spin_lock(&isec->lock);