* [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated
@ 2025-02-20 15:24 Max Kellermann
2025-03-15 14:06 ` Salvatore Bonaccorso
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Max Kellermann @ 2025-02-20 15:24 UTC (permalink / raw)
To: dhowells, netfs, linux-kernel; +Cc: Max Kellermann, stable
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>
---
fs/netfs/read_collect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c
index 8878b46589ff..cafadfe8e858 100644
--- a/fs/netfs/read_collect.c
+++ b/fs/netfs/read_collect.c
@@ -284,7 +284,7 @@ static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq, bool was
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);
}
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated
2025-02-20 15:24 [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated Max Kellermann
@ 2025-03-15 14:06 ` Salvatore Bonaccorso
2025-03-17 10:03 ` David Howells
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Salvatore Bonaccorso @ 2025-03-15 14:06 UTC (permalink / raw)
To: Max Kellermann; +Cc: dhowells, netfs, linux-kernel, stable
Hi,
On Thu, Feb 20, 2025 at 04:24:50PM +0100, Max Kellermann wrote:
> 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>
> ---
> fs/netfs/read_collect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c
> index 8878b46589ff..cafadfe8e858 100644
> --- a/fs/netfs/read_collect.c
> +++ b/fs/netfs/read_collect.c
> @@ -284,7 +284,7 @@ static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq, bool was
> 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);
> }
> --
> 2.47.2
Unless I did some mistakes researching both the stable, netfs lists,
did this felt through the cracks and is still missing for to be picked
for the 6.12.y and 6.13.y series?
Regards,
Salvatore
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated
2025-02-20 15:24 [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated Max Kellermann
2025-03-15 14:06 ` Salvatore Bonaccorso
@ 2025-03-17 10:03 ` David Howells
2025-03-19 14:19 ` Greg Kroah-Hartman
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.12-stable tree gregkh
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.13-stable tree gregkh
3 siblings, 1 reply; 6+ messages in thread
From: David Howells @ 2025-03-17 10:03 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: dhowells, Max Kellermann, netfs, linux-kernel, stable
Hi Greg,
Could you pick this up for 6.12.y and 6.13.y?
https://lore.kernel.org/netfs/20250220152450.1075727-1-max.kellermann@ionos.com/
Thanks,
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated
2025-03-17 10:03 ` David Howells
@ 2025-03-19 14:19 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2025-03-19 14:19 UTC (permalink / raw)
To: David Howells; +Cc: Max Kellermann, netfs, linux-kernel, stable
On Mon, Mar 17, 2025 at 10:03:12AM +0000, David Howells wrote:
> Hi Greg,
>
> Could you pick this up for 6.12.y and 6.13.y?
>
> https://lore.kernel.org/netfs/20250220152450.1075727-1-max.kellermann@ionos.com/
Oops, missed this, sorry, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.12-stable tree
2025-02-20 15:24 [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated Max Kellermann
2025-03-15 14:06 ` Salvatore Bonaccorso
2025-03-17 10:03 ` David Howells
@ 2025-03-19 14:20 ` gregkh
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.13-stable tree gregkh
3 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2025-03-19 14:20 UTC (permalink / raw)
To: dhowells, gregkh, max.kellermann, netfs; +Cc: stable-commits
This is a note to let you know that I've just added the patch titled
fs/netfs/read_collect: add to next->prev_donated
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
fs-netfs-read_collect-add-to-next-prev_donated.patch
and it can be found in the queue-6.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From stable+bounces-118455-greg=kroah.com@vger.kernel.org Thu Feb 20 07:27:34 2025
From: Max Kellermann <max.kellermann@ionos.com>
Date: Thu, 20 Feb 2025 16:24:50 +0100
Subject: fs/netfs/read_collect: add to next->prev_donated
To: dhowells@redhat.com, netfs@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>, stable@vger.kernel.org
Message-ID: <20250220152450.1075727-1-max.kellermann@ionos.com>
From: Max Kellermann <max.kellermann@ionos.com>
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>
---
fs/netfs/read_collect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c
index 8878b46589ff..cafadfe8e858 100644
--- a/fs/netfs/read_collect.c
+++ b/fs/netfs/read_collect.c
@@ -284,7 +284,7 @@ static bool netfs_consume_read_data(struct netfs_io_subrequest *subreq, bool was
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);
}
--
2.47.2
Patches currently in stable-queue which might be from max.kellermann@ionos.com are
queue-6.12/fs-netfs-read_collect-add-to-next-prev_donated.patch
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.13-stable tree
2025-02-20 15:24 [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated Max Kellermann
` (2 preceding siblings ...)
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.12-stable tree gregkh
@ 2025-03-19 14:20 ` gregkh
3 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2025-03-19 14:20 UTC (permalink / raw)
To: dhowells, gregkh, max.kellermann, netfs; +Cc: stable-commits
This is a note to let you know that I've just added the patch titled
fs/netfs/read_collect: add to next->prev_donated
to the 6.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
fs-netfs-read_collect-add-to-next-prev_donated.patch
and it can be found in the queue-6.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From stable+bounces-118455-greg=kroah.com@vger.kernel.org Thu Feb 20 07:27:34 2025
From: Max Kellermann <max.kellermann@ionos.com>
Date: Thu, 20 Feb 2025 16:24:50 +0100
Subject: fs/netfs/read_collect: add to next->prev_donated
To: dhowells@redhat.com, netfs@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>, stable@vger.kernel.org
Message-ID: <20250220152450.1075727-1-max.kellermann@ionos.com>
From: Max Kellermann <max.kellermann@ionos.com>
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>
---
fs/netfs/read_collect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 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);
}
Patches currently in stable-queue which might be from max.kellermann@ionos.com are
queue-6.13/fs-netfs-read_collect-add-to-next-prev_donated.patch
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-03-19 14:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 15:24 [PATCH RESEND] fs/netfs/read_collect: add to next->prev_donated Max Kellermann
2025-03-15 14:06 ` Salvatore Bonaccorso
2025-03-17 10:03 ` David Howells
2025-03-19 14:19 ` Greg Kroah-Hartman
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.12-stable tree gregkh
2025-03-19 14:20 ` Patch "fs/netfs/read_collect: add to next->prev_donated" has been added to the 6.13-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).