linux/include
Trond Myklebust f230d40147 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>
History 2025-09-04 14:28:44 +02:00
..
acpi ACPICA: Avoid sequence overread in call to strncmp() 2025-06-27 11:05:27 +01:00
asm-generic asm-generic: Add memory barrier dma_mb() 2025-08-28 16:24:36 +02:00
clocksource x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:28:42 +01:00
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-01-25 14:52:34 -08:00
drm drm/gem: Fix race in drm_gem_handle_create_tail() 2025-07-17 18:30:49 +02:00
dt-bindings clk: ti: am43xx: Add clkctrl data for am43xx ADC1 2025-07-10 15:57:35 +02:00
keys KEYS: trusted: allow use of kernel RNG for key material 2023-10-19 23:05:33 +02:00
kunit kunit: fix kernel-doc warnings due to mismatched arg names 2021-10-06 17:54:07 -06:00
kvm KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2024-07-05 09:14:51 +02:00
linux NFS: Fix a race when updating an existing write 2025-09-04 14:28:44 +02:00
math-emu math-emu: Fix fall-through warning 2021-07-13 13:57:44 -05:00
media media: v4l: Memset argument to 0 before calling get_mbus_config pad op 2025-06-04 14:38:02 +02:00
memory memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode 2022-05-09 09:14:34 +02:00
misc ocxl: Update the Process Element Entry 2020-12-04 01:01:30 +11:00
net bonding: update LACP activity flag after setting lacp_active 2025-08-28 16:24:38 +02:00
pcmcia pcmcia: Replace zero-length array with flexible-array 2020-05-18 10:28:31 +02:00
ras Revert "mm/memory-failure.c: fix race with changing page compound again" 2022-07-12 16:35:17 +02:00
rdma RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject() 2025-06-04 14:37:57 +02:00
scsi scsi: libsas: Add struct sas_tmf_task 2025-05-02 07:44:07 +02:00
soc soc: qcom: rpmh-rsc: Enhance check for VRM in-flight request 2024-06-16 13:39:55 +02:00
sound ASoC: soc-dai.h: merge DAI call back functions into ops 2025-08-28 16:24:26 +02:00
target scsi: target: Fix multiple LUN_RESET handling 2023-05-11 23:00:26 +09:00
trace erofs: remove unused trace event erofs_destroy_inode 2025-06-27 11:05:35 +01:00
uapi uapi: in6: restore visibility of most IPv6 socket options 2025-08-28 16:24:22 +02:00
vdso time64.h: Consolidated PSEC_PER_SEC definition 2021-04-06 16:32:17 -07:00
video video: of_display_timing.h: include errno.h 2022-07-12 16:35:10 +02:00
xen xen: replace xen_remap() with memremap() 2025-07-17 18:30:48 +02:00