linux/fs
David Howells d7cbf81df9 afs: Fix lock recursion
[ Upstream commit 610a79ffea ]

afs_wake_up_async_call() can incur lock recursion.  The problem is that it
is called from AF_RXRPC whilst holding the ->notify_lock, but it tries to
take a ref on the afs_call struct in order to pass it to a work queue - but
if the afs_call is already queued, we then have an extraneous ref that must
be put... calling afs_put_call() may call back down into AF_RXRPC through
rxrpc_kernel_shutdown_call(), however, which might try taking the
->notify_lock again.

This case isn't very common, however, so defer it to a workqueue.  The oops
looks something like:

  BUG: spinlock recursion on CPU#0, krxrpcio/7001/1646
   lock: 0xffff888141399b30, .magic: dead4ead, .owner: krxrpcio/7001/1646, .owner_cpu: 0
  CPU: 0 UID: 0 PID: 1646 Comm: krxrpcio/7001 Not tainted 6.12.0-rc2-build3+ #4351
  Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
  Call Trace:
   <TASK>
   dump_stack_lvl+0x47/0x70
   do_raw_spin_lock+0x3c/0x90
   rxrpc_kernel_shutdown_call+0x83/0xb0
   afs_put_call+0xd7/0x180
   rxrpc_notify_socket+0xa0/0x190
   rxrpc_input_split_jumbo+0x198/0x1d0
   rxrpc_input_data+0x14b/0x1e0
   ? rxrpc_input_call_packet+0xc2/0x1f0
   rxrpc_input_call_event+0xad/0x6b0
   rxrpc_input_packet_on_conn+0x1e1/0x210
   rxrpc_input_packet+0x3f2/0x4d0
   rxrpc_io_thread+0x243/0x410
   ? __pfx_rxrpc_io_thread+0x10/0x10
   kthread+0xcf/0xe0
   ? __pfx_kthread+0x10/0x10
   ret_from_fork+0x24/0x40
   ? __pfx_kthread+0x10/0x10
   ret_from_fork_asm+0x1a/0x30
   </TASK>

Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/1394602.1729162732@warthog.procyon.org.uk
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-17 15:09:53 +01:00
..
9p 9p: v9fs_fid_find: also lookup by inode if not found dentry 2024-11-17 15:09:50 +01:00
adfs fs/adfs: add MODULE_DESCRIPTION 2024-07-18 09:50:08 +02:00
affs affs: struct slink_front: Replace 1-element array with flexible array 2024-07-11 16:14:26 +02:00
afs afs: Fix lock recursion 2024-11-17 15:09:53 +01:00
autofs autofs: fix missing fput for FSCONFIG_SET_FD 2024-10-04 16:37:19 +02:00
bcachefs bcachefs: Don't delete open files in online fsck 2024-09-09 09:41:47 -04:00
befs befs: Convert befs_symlink_read_folio() to use folio_end_read() 2024-05-31 12:31:39 +02:00
bfs
btrfs block: rework bio splitting 2024-11-14 13:21:15 +01:00
cachefiles cachefiles: fix dentry leak in cachefiles_open_file() 2024-10-10 12:04:07 +02:00
ceph ceph: fix cap ref leak via netfs init_request 2024-10-10 12:04:10 +02:00
coda coda: Convert coda_symlink_filler() to use folio_end_read() 2024-05-31 12:31:39 +02:00
configfs fs/configfs: Add a callback to determine attribute visibility 2024-06-17 20:42:57 +02:00
cramfs vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
crypto
debugfs debugfs show actual source in /proc/mounts 2024-10-04 16:38:46 +02:00
devpts
dlm dlm: add rcu_barrier before destroy kmem cache 2024-06-13 12:48:46 -05:00
ecryptfs
efivarfs efivarfs: Convert to new uid/gid option parsing helpers 2024-07-02 06:21:18 +02:00
efs vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
erofs erofs: handle overlapped pclusters out of crafted images properly 2024-10-04 16:37:33 +02:00
exfat exfat: fix memory leak in exfat_load_bitmap() 2024-10-10 12:03:58 +02:00
exportfs fhandle: relax open_by_handle_at() permission checks 2024-05-28 15:57:23 +02:00
ext2 ext2: Verify bitmap and itable block numbers before using them 2024-06-26 12:54:11 +02:00
ext4 ext4: nested locking for xattr inode 2024-10-17 15:26:34 +02:00
f2fs f2fs: forcibly migrate to secure space for zoned device file pinning 2024-10-10 12:03:45 +02:00
fat fat: fix uninitialized variable 2024-10-22 15:51:20 +02:00
freevxfs
fuse fuse: update inode size after extending passthrough write 2024-11-01 02:02:38 +01:00
gfs2 gfs2: fix double destroy_workqueue error 2024-10-10 12:04:01 +02:00
hfs vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
hfsplus vfs-6.11.misc 2024-07-15 10:52:51 -07:00
hostfs vfs-6.11-rc1.fixes.3 2024-07-27 15:11:59 -07:00
hpfs vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
hugetlbfs - 875fa64577 ("mm/hugetlb_vmemmap: fix race with speculative PFN 2024-07-21 17:15:46 -07:00
iomap iomap: turn iomap_want_unshare_iter into an inline function 2024-11-08 16:30:49 +01:00
isofs \n 2024-07-17 13:11:42 -07:00
jbd2 jbd2: correctly compare tids with tid_geq function in jbd2_fc_begin_commit 2024-10-10 12:03:55 +02:00
jffs2 Kbuild updates for v6.11 2024-07-23 14:32:21 -07:00
jfs jfs: Fix sanity check in dbMount 2024-11-01 02:02:34 +01:00
kernfs
lockd lockd: Use *-y instead of *-objs in Makefile 2024-07-08 14:10:03 -04:00
minix vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
netfs netfs: Downgrade i_rwsem for a buffered write 2024-11-17 15:09:53 +01:00
nfs nfs: Fix KMSAN warning in decode_getfattr_attrs() 2024-11-14 13:21:08 +01:00
nfs_common fs: nfs: add missing MODULE_DESCRIPTION() macros 2024-07-08 13:47:24 -04:00
nfsd NFSD: Never decrement pending_async_copies on error 2024-11-08 16:30:52 +01:00
nilfs2 nilfs2: fix potential deadlock with newly created symlinks 2024-11-08 16:30:55 +01:00
nls fs: nls: add missing MODULE_DESCRIPTION() macros 2024-06-03 16:37:07 +02:00
notify fsnotify: Avoid data race between fsnotify_recalc_mask() and fsnotify_object_watched() 2024-11-01 02:02:34 +01:00
ntfs3 fs/ntfs3: Sequential field availability check in mi_enum_attr() 2024-11-08 16:31:04 +01:00
ocfs2 fs: Fix uninitialized value issue in from_kuid and from_kgid 2024-11-17 15:09:53 +01:00
omfs
openpromfs openpromfs: add missing MODULE_DESCRIPTION() macro 2024-06-20 09:46:01 +02:00
orangefs orangefs: Remove calls to set/clear the error flag 2024-05-31 12:31:41 +02:00
overlayfs fs: pass offset and result to backing_file end_write() callback 2024-11-01 02:02:38 +01:00
proc fs/proc: fix compile warning about variable 'vmcore_mmap_ops' 2024-11-14 13:21:11 +01:00
pstore memblock: updates for 6.11-rc1 2024-07-18 14:48:11 -07:00
qnx4 qnx4: add MODULE_DESCRIPTION() 2024-05-28 11:52:53 +02:00
qnx6 qnx6: add MODULE_DESCRIPTION() 2024-05-28 11:52:49 +02:00
quota quota: avoid missing put_quota_format when DQUOT_SUSPENDED is passed 2024-10-04 16:38:06 +02:00
ramfs
reiserfs reiserfs: Remove call to folio_set_error() 2024-05-31 12:31:41 +02:00
romfs romfs: fix romfs_read_folio() 2024-08-21 22:32:58 +02:00
smb smb: client: Fix use-after-free of network namespace. 2024-11-17 15:09:50 +01:00
squashfs Squashfs: sanity check symbolic link size 2024-08-13 13:56:46 +02:00
sysfs
sysv fs: sysv: add MODULE_DESCRIPTION() 2024-05-28 11:52:45 +02:00
tests execve: Move KUnit tests to tests/ subdirectory 2024-07-22 18:25:47 -07:00
tracefs tracing: Fix tracefs mount options 2024-11-14 13:21:09 +01:00
ubifs ubifs: add check for crypto_shash_tfm_digest 2024-07-12 22:01:09 +02:00
udf udf: fix uninit-value use in udf_get_fileshortad 2024-11-01 02:02:34 +01:00
ufs - In the series "treewide: Refactor heap related implementation", 2024-07-21 17:56:22 -07:00
unicode unicode: Don't special case ignorable code points 2024-10-17 15:26:31 +02:00
vboxsf vfs-6.11.mount.api 2024-07-15 11:31:32 -07:00
verity bpf: treewide: Align kfunc signatures to prog point-of-view 2024-06-12 11:01:31 -07:00
xfs xfs: fix finding a last resort AG in xfs_filestream_pick_ag 2024-11-08 16:30:59 +01:00
zonefs zonefs: enable support for large folios 2024-06-11 11:22:57 +09:00
aio.c - 875fa64577 ("mm/hugetlb_vmemmap: fix race with speculative PFN 2024-07-21 17:15:46 -07:00
anon_inodes.c
attr.c nfsd-6.11 fixes: 2024-08-29 06:20:44 +12:00
backing-file.c fs: pass offset and result to backing_file end_write() callback 2024-11-01 02:02:38 +01:00
bad_inode.c
binfmt_elf_fdpic.c binfmt_elf_fdpic: fix AUXV size calculation when ELF_HWCAP2 is defined 2024-08-26 13:00:38 -07:00
binfmt_elf.c execve fix for v6.11-rc1 2024-07-23 17:30:42 -07:00
binfmt_flat.c binfmt_flat: Fix corruption when not offsetting data start 2024-08-09 20:19:00 -07:00
binfmt_misc.c vfs-6.11.module.description 2024-07-15 11:14:59 -07:00
binfmt_script.c fs: binfmt: add missing MODULE_DESCRIPTION() macros 2024-05-28 12:06:51 +02:00
buffer.c Many cleanups and bug fixes in ext4, especially for the fast commit 2024-07-18 17:03:42 -07:00
char_dev.c
compat_binfmt_elf.c
coredump.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
d_path.c
dax.c fsdax: dax_unshare_iter needs to copy entire blocks 2024-11-08 16:30:49 +01:00
dcache.c dcache: keep dentry_hashtable or d_hash_shift even when not used 2024-08-30 12:25:50 +12:00
direct-io.c
drop_caches.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
eventfd.c
eventpoll.c eventpoll: Annotate data-race of busy_poll_usecs 2024-10-04 16:38:50 +02:00
exec.c parisc: Fix stack start for ADDR_NO_RANDOMIZE personality 2024-10-10 12:03:54 +02:00
fcntl.c fs: Fix file_set_fowner LSM hook inconsistencies 2024-10-04 16:38:50 +02:00
fhandle.c fhandle: relax open_by_handle_at() permission checks 2024-05-28 15:57:23 +02:00
file_table.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
file.c close_range(): fix the logics in descriptor table trimming 2024-10-10 12:04:11 +02:00
filesystems.c
fs_context.c
fs_parser.c fs_parse: add uid & gid option option parsing helpers 2024-07-02 06:20:49 +02:00
fs_pin.c
fs_struct.c
fs_types.c
fs-writeback.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
fsopen.c vfs: retire user_path_at_empty and drop empty arg from getname_flags 2024-06-05 17:03:57 +02:00
init.c
inode.c vfs: use RCU in ilookup 2024-10-10 12:03:15 +02:00
internal.h vfs-6.11.pidfs 2024-07-15 12:34:01 -07:00
ioctl.c
Kconfig
Kconfig.binfmt exec: Add KUnit test for bprm_stack_limits() 2024-06-19 13:13:55 -07:00
kernel_read_file.c
libfs.c libfs: fix get_stashed_dentry() 2024-09-06 11:08:58 -07:00
locks.c filelock: fix name of file_lease slab cache 2024-08-12 22:03:25 +02:00
Makefile
mbcache.c
mnt_idmapping.c
mount.h vfs-6.11.mount 2024-07-15 11:54:04 -07:00
mpage.c buffer: Remove calls to set and clear the folio error flag 2024-05-31 12:31:43 +02:00
namei.c vfs: correct the comments of vfs_*() helpers 2024-07-24 10:53:12 +02:00
namespace.c fs: don't try and remove empty rbtree node 2024-11-01 02:02:41 +01:00
nsfs.c nsfs: use cleanup guard 2024-07-18 09:50:08 +02:00
open.c openat2: explicitly return -E2BIG for (usize > PAGE_SIZE) 2024-11-01 02:02:41 +01:00
pidfs.c pidfs: check for valid pid namespace 2024-10-10 12:04:07 +02:00
pipe.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c fs: rename show_mnt_opts -> show_vfsmnt_opts 2024-06-28 14:36:43 +02:00
read_write.c fs: Initial atomic write support 2024-06-20 15:19:17 -06:00
readdir.c readdir: Add missing quote in macro comment 2024-06-03 15:49:26 +02:00
remap_range.c
select.c x86: support user address masking instead of non-speculative conditional 2024-11-01 02:02:44 +01:00
seq_file.c
signalfd.c signalfd: drop an obsolete comment 2024-05-24 13:34:07 +02:00
splice.c
stack.c
stat.c for-6.11/block-20240710 2024-07-15 14:20:22 -07:00
statfs.c
super.c fs/super.c: improve get_tree() error message 2024-08-22 02:07:23 -04:00
sync.c
sysctls.c
timerfd.c
userfaultfd.c fork: do not invoke uffd on fork if error occurs 2024-11-08 16:30:58 +01:00
utimes.c
xattr.c vfs: Fix potential circular locking through setxattr() and removexattr() 2024-07-24 10:53:14 +02:00