linux-stable/fs
Trond Myklebust 181feb41f0 NFS: Fix a race when updating an existing write
commit 76d2e3890f upstream.

After nfs_lock_and_join_requests() tests for whether the request is
still attached to the mapping, nothing prevents a call to
nfs_inode_remove_request() from succeeding until we actually lock the
page group.
The reason is that whoever called nfs_inode_remove_request() doesn't
necessarily have a lock on the page group head.

So in order to avoid races, let's take the page group lock earlier in
nfs_lock_and_join_requests(), and hold it across the removal of the
request in nfs_inode_remove_request().

Reported-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Joe Quanaim <jdq@meta.com>
Tested-by: Andrew Steffen <aksteffen@meta.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Fixes: bd37d6fce1 ("NFSv4: Convert nfs_lock_and_join_requests() to use nfs_page_find_head_request()")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-04 15:30:20 +02:00
..
9p
adfs
affs
afs
autofs
befs
bfs
btrfs btrfs: send: make fs_path_len() inline and constify its argument 2025-08-28 16:28:41 +02:00
cachefiles
ceph
coda
configfs
cramfs
crypto fscrypt: Don't use problematic non-inline crypto engines 2025-08-28 16:28:40 +02:00
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
erofs erofs: fix atomic context detection when !CONFIG_DEBUG_LOCK_ALLOC 2025-09-04 15:30:19 +02:00
exfat exfat: add cluster chain loop check for dir 2025-08-28 16:28:28 +02:00
exportfs
ext2 ext2: Handle fiemap on empty files to prevent EINVAL 2025-08-28 16:28:15 +02:00
ext4 ext4: preserve SB_I_VERSION on remount 2025-08-28 16:28:44 +02:00
f2fs f2fs: fix to avoid out-of-boundary access in dnode page 2025-08-28 16:28:36 +02:00
fat
freevxfs
fscache
fuse
gfs2 gfs2: Set .migrate_folio in gfs2_{rgrp,meta}_aops 2025-08-28 16:28:15 +02:00
hfs hfs: fix not erasing deleted b-tree node issue 2025-08-28 16:28:15 +02:00
hfsplus hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() 2025-08-28 16:28:14 +02:00
hostfs
hpfs
hugetlbfs mm: update memfd seal write check to include F_SEAL_WRITE 2025-08-28 16:28:39 +02:00
iomap
isofs
jbd2 jbd2: prevent softlockup in jbd2_log_do_checkpoint() 2025-08-28 16:28:36 +02:00
jffs2
jfs jfs: upper bound check of tree index in dbAllocAG 2025-08-28 16:28:26 +02:00
kernfs
lockd
minix
netfs
nfs NFS: Fix a race when updating an existing write 2025-09-04 15:30:20 +02:00
nfs_common
nfsd NFSD: detect mismatch of file handle and delegation stateid in OPEN op 2025-08-28 16:28:11 +02:00
nilfs2
nls
notify
ntfs
ntfs3 fs/ntfs3: correctly create symlink for relative path 2025-08-28 16:28:15 +02:00
ocfs2
omfs
openpromfs
orangefs fs/orangefs: use snprintf() instead of sprintf() 2025-08-28 16:28:25 +02:00
overlayfs
proc
pstore
qnx4
qnx6
quota
ramfs
reiserfs
romfs
smb smb: client: fix race with concurrent opens in rename(2) 2025-09-04 15:30:19 +02:00
squashfs squashfs: fix memory leak in squashfs_fill_super 2025-08-28 16:28:43 +02:00
sysfs
sysv
tracefs tracefs: Add d_delete to remove negative dentries 2025-08-28 16:28:15 +02:00
ubifs
udf udf: Verify partition map count 2025-08-28 16:28:15 +02:00
ufs
unicode
vboxsf
verity
xfs xfs: fully decouple XFS_IBULK* flags from XFS_IWALK* flags 2025-08-28 16:28:40 +02:00
zonefs
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_elf_fdpic.c
binfmt_elf_test.c
binfmt_elf.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
buffer.c fs/buffer: fix use-after-free when call bh_read() helper 2025-08-28 16:28:44 +02:00
char_dev.c
compat_binfmt_elf.c
coredump.c
d_path.c
dax.c
dcache.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c eventpoll: Fix semi-unbounded recursion 2025-08-28 16:28:12 +02:00
exec.c
fcntl.c
fhandle.c
file_table.c
file.c alloc_fdtable(): change calling conventions. 2025-08-28 16:28:50 +02:00
filesystems.c
fs_context.c
fs_parser.c
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c
fsopen.c
init.c
inode.c
internal.h
ioctl.c
Kconfig
Kconfig.binfmt
kernel_read_file.c
libfs.c better lockdep annotations for simple_recursive_removal() 2025-08-28 16:28:15 +02:00
locks.c
Makefile
mbcache.c
mnt_idmapping.c
mount.h
mpage.c
namei.c
namespace.c use uniform permission checks for all mount propagation changes 2025-08-28 16:28:44 +02:00
nsfs.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
sysctls.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c