summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max.kellermann@ionos.com>2025-02-20 16:24:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-22 12:54:28 -0700
commit62b9ad7e52d4777f7e775ee1f0ad2452f6041024 (patch)
treedd04e76e3f03c1ffac9aaacbbce80e7d7881a424
parent8f324d99306b8fc5307901aa023c34c0879f81dd (diff)
fs/netfs/read_collect: add to next->prev_donated
If multiple subrequests donate data to the same "next" request (depending on the subrequest completion order), each of them would overwrite the `prev_donated` field, causing data corruption and a BUG() crash ("Can't donate prior to front"). Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading") Closes: https://lore.kernel.org/netfs/CAKPOu+_4mUwYgQtRTbXCmi+-k3PGvLysnPadkmHOyB7Gz0iSMA@mail.gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/netfs/read_collect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c
index 3b9461f5e712..eae415efae24 100644
--- a/fs/netfs/read_collect.c
+++ b/fs/netfs/read_collect.c
@@ -284,7 +284,7 @@ donation_changed:
netfs_trace_donate_to_deferred_next);
} else {
next = list_next_entry(subreq, rreq_link);
- WRITE_ONCE(next->prev_donated, excess);
+ WRITE_ONCE(next->prev_donated, next->prev_donated + excess);
trace_netfs_donate(rreq, subreq, next, excess,
netfs_trace_donate_to_next);
}