Matthew Wilcox (Oracle)
7a78aa92e5
UPSTREAM: xarray: Fix early termination of xas_for_each_marked
...
commit 7e934cf5ace1dceeb804f7493fa28bb697ed3c52 upstream.
xas_for_each_marked() is using entry == NULL as a termination condition
of the iteration. When xas_for_each_marked() is used protected only by
RCU, this can however race with xas_store(xas, NULL) in the following
way:
TASK1 TASK2
page_cache_delete() find_get_pages_range_tag()
xas_for_each_marked()
xas_find_marked()
off = xas_find_chunk()
xas_store(&xas, NULL)
xas_init_marks(&xas);
...
rcu_assign_pointer(*slot, NULL);
entry = xa_entry(off);
And thus xas_for_each_marked() terminates prematurely possibly leading
to missed entries in the iteration (translating to missing writeback of
some pages or a similar problem).
If we find a NULL entry that has been marked, skip it (unless we're trying
to allocate an entry).
Reported-by: Jan Kara <jack@suse.cz >
CC: stable@vger.kernel.org
Fixes: ef8e5717db01 ("page cache: Convert delete_batch to XArray")
Change-Id: I99b5db5bfdc34e9fa4bfc0a963d5e93dde33fa38
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2026-05-31 11:15:40 +01:00
..
2025-11-21 22:57:50 +00:00
2026-04-09 14:44:43 +08:00
2026-04-22 07:08:43 +01:00
2025-08-31 10:10:00 +01:00
2026-05-12 18:00:02 +01:00
2026-02-06 18:23:19 +02:00
2026-02-02 18:01:34 -05:00
2025-09-02 08:35:50 +00:00
2026-02-06 18:23:19 +02:00
2025-10-16 21:01:06 +01:00
2025-09-30 21:35:03 +01:00
2025-12-22 04:34:10 +01:00
2025-09-22 10:17:52 +02:00
2025-08-28 03:27:41 +03:00
2025-08-28 03:27:45 +03:00
2026-02-02 18:01:33 -05:00
2026-02-02 18:01:35 -05:00
2025-08-28 03:28:38 +03:00
2026-02-02 18:01:34 -05:00
2026-02-02 18:01:35 -05:00
2025-08-28 03:27:57 +03:00
2025-08-28 03:28:11 +03:00
2025-09-08 01:34:41 -04:00
2025-09-08 01:35:16 -04:00
2025-08-28 03:29:06 +03:00
2025-12-31 12:15:33 +02:00
2026-02-06 18:23:19 +02:00
2026-02-06 18:23:19 +02:00
2026-01-23 15:34:20 +00:00
2025-08-28 03:28:07 +03:00
2026-04-12 13:56:45 +08:00
2025-09-30 21:35:04 +01:00
2025-08-28 03:29:12 +03:00
2025-10-16 21:01:10 +01:00
2025-09-02 08:35:50 +00:00
2026-05-31 11:15:37 +01:00
2026-05-31 11:15:34 +01:00
2026-05-31 11:15:35 +01:00
2026-05-31 11:15:36 +01:00
2025-10-05 09:11:31 +00:00
2025-08-31 10:09:52 +01:00
2025-12-31 12:15:33 +02:00
2026-01-21 21:23:37 +00:00
2025-10-16 21:01:10 +01:00
2025-08-31 10:09:52 +01:00
2026-03-20 17:35:06 +00:00
2025-09-30 21:35:03 +01:00
2026-01-29 12:09:34 +08:00
2025-10-17 15:32:06 +01:00
2025-09-30 21:35:04 +01:00
2026-03-20 13:38:05 -04:00
2026-03-20 13:38:05 -04:00
2026-02-02 18:01:36 -05:00
2026-03-20 13:38:05 -04:00
2026-02-02 18:01:37 -05:00
2025-10-17 18:58:06 +01:00
2025-09-02 08:35:50 +00:00
2025-09-30 21:35:04 +01:00
2025-10-16 21:01:06 +01:00
2025-09-30 21:35:04 +01:00
2026-03-20 13:40:21 -04:00
2026-05-13 00:48:26 +00:00
2026-04-28 18:54:34 +00:00
2026-04-28 18:54:34 +00:00
2025-09-30 21:35:03 +01:00
2025-10-16 21:01:06 +01:00
2026-05-04 17:32:39 +03:00
2026-05-31 11:15:36 +01:00
2025-10-16 21:01:06 +01:00
2025-09-30 21:35:04 +01:00
2025-09-02 08:35:50 +00:00
2025-10-16 21:01:10 +01:00
2025-08-28 03:28:51 +03:00
2025-09-30 21:35:04 +01:00
2025-09-08 01:35:15 -04:00
2025-09-08 01:35:15 -04:00
2025-09-02 08:35:50 +00:00
2025-09-08 01:35:14 -04:00
2025-09-30 21:35:04 +01:00
2025-09-08 01:34:41 -04:00
2026-04-21 04:58:22 +00:00
2025-09-30 21:35:04 +01:00
2025-10-17 15:32:07 +01:00
2025-08-28 03:27:42 +03:00
2025-08-31 23:56:41 +08:00
2026-03-20 13:38:05 -04:00
2026-03-20 13:38:02 -04:00
2025-09-30 21:35:02 +01:00
2026-01-29 12:09:30 +08:00
2025-09-30 21:35:03 +01:00
2025-10-16 21:01:06 +01:00
2025-10-16 21:01:06 +01:00
2025-10-05 09:11:31 +00:00
2025-09-30 21:35:04 +01:00
2025-10-17 15:32:06 +01:00
2025-09-30 21:35:04 +01:00
2025-10-16 21:01:06 +01:00
2025-10-16 21:01:06 +01:00
2025-10-16 21:01:06 +01:00
2025-10-16 21:01:06 +01:00
2025-09-16 13:55:10 +02:00
2025-09-02 08:35:50 +00:00
2025-08-31 10:09:54 +01:00
2026-05-31 11:15:38 +01:00
2025-10-17 19:01:57 +01:00
2026-04-28 18:54:34 +00:00
2026-01-26 16:51:55 +08:00
2025-08-28 03:28:51 +03:00
2025-08-28 03:27:50 +03:00
2025-09-30 21:35:04 +01:00
2026-05-31 11:15:34 +01:00
2025-09-30 21:35:04 +01:00
2025-10-16 21:01:12 +01:00
2026-02-02 18:01:34 -05:00
2025-09-30 21:35:04 +01:00
2025-10-17 19:01:57 +01:00
2026-05-04 17:32:39 +03:00
2026-02-02 18:01:33 -05:00
2026-04-28 18:54:34 +00:00
2025-08-28 03:28:07 +03:00
2025-08-28 03:28:08 +03:00
2025-08-28 03:28:56 +03:00
2025-09-30 21:35:04 +01:00
2025-10-16 21:01:06 +01:00
2026-05-31 11:15:38 +01:00
2026-05-31 11:15:37 +01:00
2025-12-31 12:15:33 +02:00
2025-10-16 21:01:06 +01:00
2025-08-28 03:27:39 +03:00
2026-02-20 13:22:28 +08:00
2025-09-02 08:35:50 +00:00
2025-09-02 08:35:50 +00:00
2025-10-17 17:31:44 +01:00
2025-08-28 03:28:09 +03:00
2026-05-12 18:00:02 +01:00
2025-08-28 03:28:30 +03:00
2026-02-06 18:23:19 +02:00
2025-08-31 10:10:02 +01:00
2026-04-09 14:44:46 +08:00
2025-09-30 21:35:04 +01:00
2026-05-31 11:15:40 +01:00
2025-08-28 03:29:03 +03:00