linux/fs
Mike Snitzer 3af870aedb nfs/localio: fix regression due to out-of-order __put_cred
Commit f2060bdc21 ("nfs/localio: add refcounting for each iocb IO
associated with NFS pgio header") inadvertantly reintroduced the same
potential for __put_cred() triggering BUG_ON(cred == current->cred) that
commit 992203a1fb ("nfs/localio: restore creds before releasing pageio
data") fixed.

Fix this by saving and restoring the cred around each {read,write}_iter
call within the respective for loop of nfs_local_call_{read,write} using
scoped_with_creds().

NOTE: this fix started by first reverting the following commits:

 94afb627df ("nfs: use credential guards in nfs_local_call_read()")
 bff3c841f7 ("nfs: use credential guards in nfs_local_call_write()")
 1d18101a64 ("Merge tag 'kernel-6.19-rc1.cred' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs")

followed by narrowly fixing the cred lifetime issue by using
scoped_with_creds().  In doing so, this commit's changes appear more
extensive than they really are (as evidenced by comparing to v6.18's
fs/nfs/localio.c).

Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Acked-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/linux-next/20251205111942.4150b06f@canb.auug.org.au/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2025-12-05 17:53:56 -08:00
..
9p vfs-6.19-rc1.fs_header 2025-12-01 14:18:01 -08:00
adfs
affs
afs Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
autofs vfs-6.19-rc1.fixes 2025-12-05 15:52:30 -08:00
befs
bfs vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
btrfs ARM: 2025-12-05 17:01:20 -08:00
cachefiles vfs-6.19-rc1.directory.locking 2025-12-01 16:13:46 -08:00
ceph printk changes for 6.19 2025-12-03 12:42:36 -08:00
coda
configfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
cramfs
crypto vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
debugfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
devpts convert devpts 2025-11-16 01:35:04 -05:00
dlm net: Convert proto callbacks from sockaddr to sockaddr_unsized 2025-11-04 19:10:33 -08:00
ecryptfs vfs-6.19-rc1.directory.locking 2025-12-01 16:13:46 -08:00
efivarfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
efs
erofs ARM: 2025-12-05 17:01:20 -08:00
exfat exfat: fix remount failure in different process environments 2025-12-03 10:00:17 +09:00
exportfs
ext2
ext4 New features and improvements for the ext4 file system 2025-12-03 20:37:15 -08:00
f2fs ARM: 2025-12-05 17:01:20 -08:00
fat vfs-6.19-rc1.fs_header 2025-12-01 14:18:01 -08:00
freevxfs
fuse fuse update for 6.19 2025-12-05 15:25:13 -08:00
gfs2 gfs2 changes 2025-12-03 20:28:50 -08:00
hfs hfs/hfsplus updates for v6.19 2025-12-03 20:08:32 -08:00
hfsplus hfs/hfsplus updates for v6.19 2025-12-03 20:08:32 -08:00
hostfs Apart from the usual small churn, we have 2025-12-05 16:30:56 -08:00
hpfs vfs-6.19-rc1.fs_header 2025-12-01 14:18:01 -08:00
hugetlbfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
iomap vfs-6.19-rc1.folio 2025-12-01 10:26:38 -08:00
isofs vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
jbd2 jbd2: fix the inconsistency between checksum and data in memory for journal sb 2025-11-26 17:05:47 -05:00
jffs2
jfs vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
kernfs
lockd tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
minix vfs-6.19-rc1.minix 2025-12-01 15:22:40 -08:00
netfs vfs-6.19-rc1.folio 2025-12-01 10:26:38 -08:00
nfs nfs/localio: fix regression due to out-of-order __put_cred 2025-12-05 17:53:56 -08:00
nfs_common
nfsd Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
nilfs2 vfs-6.19-rc1.fs_header 2025-12-01 14:18:01 -08:00
nls
notify vfs-6.19-rc1.fd_prepare.fs 2025-12-01 17:32:07 -08:00
ntfs3 Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
ocfs2 Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
omfs vfs-6.19-rc1.fs_header 2025-12-01 14:18:01 -08:00
openpromfs
orangefs vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
overlayfs ovl: pass original credentials, not mounter credentials during create 2025-12-05 16:16:20 -08:00
proc Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
pstore Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
qnx4
qnx6
quota
ramfs Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
resctrl Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
romfs
smb Forty four smb client and server changesets 2025-12-03 20:23:41 -08:00
squashfs
sysfs
tests
tracefs convert tracefs 2025-11-16 01:35:03 -05:00
ubifs
udf
ufs
unicode
vboxsf
verity
xfs xfs: new code for v6.19 2025-12-03 20:19:38 -08:00
zonefs vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
Kconfig
Kconfig.binfmt
Makefile fs: rename fs_types.h to fs_dirent.h 2025-11-05 09:51:30 +01:00
aio.c
anon_inodes.c anon_inodes: convert to FD_ADD() 2025-11-28 12:42:31 +01:00
attr.c filelock: add struct delegated_inode 2025-11-12 09:38:34 +01:00
backing-file.c kernel-6.19-rc1.cred 2025-12-01 13:45:41 -08:00
bad_inode.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_flat.c
binfmt_misc.c Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
binfmt_script.c
bpf_fs_kfuncs.c
buffer.c vfs-6.19-rc1.folio 2025-12-01 10:26:38 -08:00
char_dev.c
compat_binfmt_elf.c
coredump.c Networking changes for 6.19. 2025-12-03 17:24:33 -08:00
d_path.c
dax.c Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
dcache.c fuse update for 6.19 2025-12-05 15:25:13 -08:00
direct-io.c
drop_caches.c
eventfd.c eventfd: convert do_eventfd() to FD_PREPARE() 2025-11-28 12:42:31 +01:00
eventpoll.c eventpoll: convert do_epoll_create() to FD_PREPARE() 2025-11-28 12:42:32 +01:00
exec.c A large overhaul of the restartable sequences and CID management: 2025-12-02 08:48:53 -08:00
fcntl.c vfs: expose delegation support to userland 2025-11-12 09:38:37 +01:00
fhandle.c fhandle: convert do_handle_open() to FD_ADD() 2025-11-28 12:42:31 +01:00
file.c vfs-6.19-rc1.fd_prepare.fs 2025-12-01 17:32:07 -08:00
file_attr.c fs: remove spurious exports in fs/file_attr.c 2025-11-19 12:17:31 +01:00
file_table.c
filesystems.c
fs-writeback.c vfs-6.19-rc1.writeback 2025-12-01 09:20:51 -08:00
fs_context.c
fs_dirent.c fs: rename fs_types.h to fs_dirent.h 2025-11-05 09:51:30 +01:00
fs_parser.c
fs_pin.c
fs_struct.c fs: inline current_umask() and move it to fs_struct.h 2025-11-05 22:51:23 +01:00
fsopen.c
init.c vfs: make vfs_symlink break delegations on parent dir 2025-11-12 09:38:36 +01:00
inode.c fs: assert on I_FREEING not being set in iput() and iput_not_last() 2025-12-03 11:14:50 +01:00
internal.h Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
ioctl.c
kernel_read_file.c
libfs.c Some filesystems use a kinda-sorta controlled dentry refcount leak to pin 2025-12-05 14:36:21 -08:00
locks.c filelock: __fcntl_getlease: fix kernel-doc warnings 2025-11-28 10:30:41 +01:00
mbcache.c
mnt_idmapping.c
mount.h fs: use boolean to indicate anonymous mount namespace 2025-11-11 10:01:31 +01:00
mpage.c
namei.c vfs-6.19-rc1.directory.locking 2025-12-01 16:13:46 -08:00
namespace.c vfs-6.19-rc1.fd_prepare.fs 2025-12-01 17:32:07 -08:00
nsfs.c vfs-6.19-rc1.fd_prepare.fs 2025-12-01 17:32:07 -08:00
open.c vfs-6.19-rc1.fd_prepare.fs 2025-12-01 17:32:07 -08:00
pidfs.c vfs-6.19-rc1.coredump 2025-12-01 10:17:39 -08:00
pipe.c Summary 2025-12-05 11:15:37 -08:00
pnode.c
pnode.h
posix_acl.c filelock: add struct delegated_inode 2025-11-12 09:38:34 +01:00
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c
seq_file.c
signalfd.c signalfd: convert do_signalfd4() to FD_ADD() 2025-11-28 12:42:32 +01:00
splice.c fs/splice.c: trivial fix: pipes -> pipe's 2025-11-25 10:11:16 +01:00
stack.c
stat.c
statfs.c
super.c vfs-6.19-rc1.fixes 2025-12-05 15:52:30 -08:00
sync.c vfs-6.19-rc1.writeback 2025-12-01 09:20:51 -08:00
sysctls.c
timerfd.c timerfd: convert timerfd_create() to FD_ADD() 2025-11-28 12:42:32 +01:00
userfaultfd.c Significant patch series in this merge are as follows: 2025-12-05 13:52:43 -08:00
utimes.c vfs-6.19-rc1.directory.delegations 2025-12-01 15:34:41 -08:00
xattr.c filelock: add struct delegated_inode 2025-11-12 09:38:34 +01:00