[merged mm-stable] mm-shmem-annotate-benign-data-race-in-shmem_getattr.patch removed from -mm tree

Andrew Morton <[email protected]> Tue, 04 Aug 2026 19:23:34 -0700
Newsgroups org.kernel.vger.mm-commits
Message-ID <[email protected]>
The quilt patch titled
     Subject: mm/shmem: annotate benign data-race in shmem_getattr()
has been removed from the -mm tree.  Its filename was
     mm-shmem-annotate-benign-data-race-in-shmem_getattr.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jaeyeon Lee <[email protected]>
Subject: mm/shmem: annotate benign data-race in shmem_getattr()
Date: Wed, 8 Jul 2026 13:19:41 +0200

shmem_getattr() reads info->alloced, info->swapped and i_mapping->nrpages
without info->lock to decide whether shmem_recalc_inode() should be
called.  shmem_recalc_inode() recomputes these under info->lock, so a
stale read here only affects whether shmem_recalc_inode() runs.

Annotate data_race() to silence KCSAN.

Link: https://lore.kernel.org/[email protected]
Signed-off-by: Jaeyeon Lee <[email protected]>
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=dfb578404df369f6599b
Cc: Baolin Wang <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Marco Elver <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/shmem.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mm/shmem.c~mm-shmem-annotate-benign-data-race-in-shmem_getattr
+++ a/mm/shmem.c
@@ -1297,7 +1297,8 @@ static int shmem_getattr(struct mnt_idma
 	struct inode *inode = path->dentry->d_inode;
 	struct shmem_inode_info *info = SHMEM_I(inode);
 
-	if (info->alloced - info->swapped != inode->i_mapping->nrpages)
+	/* Fast-path hint; recalc under info->lock corrects any stale read. */
+	if (data_race(info->alloced - info->swapped != inode->i_mapping->nrpages))
 		shmem_recalc_inode(inode, 0, 0);
 
 	if (info->fsflags & FS_APPEND_FL)
_

Patches currently in -mm which might be from [email protected] are