1
0
Fork 0
alistair23-linux/include
Matthew Wilcox (Oracle) 7e934cf5ac xarray: Fix early termination of xas_for_each_marked
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: ef8e5717db ("page cache: Convert delete_batch to XArray")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
2020-03-12 17:42:08 -04:00
..
acpi Merge branches 'acpi-utils', 'acpi-platform', 'acpi-video' and 'acpi-doc' 2019-11-26 10:30:49 +01:00
asm-generic asm-generic/nds32: don't redefine cacheflush primitives 2019-12-30 11:18:43 +01:00
clocksource x86/hyperv: Initialize clockevents earlier in CPU onlining 2019-11-15 10:33:49 +01:00
crypto crypto: ablkcipher - remove deprecated and unused ablkcipher support 2019-11-17 09:02:49 +08:00
drm drm/dp_mst: Have DP_Tx send one msg at a time 2020-01-15 17:01:21 -05:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2019-12-09 15:21:20 -08:00
keys powerpc updates for 5.5 2019-11-30 14:35:43 -08:00
kunit
kvm Merge remote-tracking branch 'kvmarm/misc-5.5' into kvmarm/next 2019-11-08 11:27:29 +00:00
linux xarray: Fix early termination of xas_for_each_marked 2020-03-12 17:42:08 -04:00
math-emu
media drm main pull for 5.5-rc1 2019-11-27 17:45:48 -08:00
misc
net netfilter: nf_tables: autoload modules from the abort path 2020-01-24 20:54:29 +01:00
pcmcia
ras
rdma IB/core: Introduce rdma_user_mmap_entry_insert_range() API 2019-12-12 16:55:36 -05:00
scsi scsi: target: iscsi: Wait for all commands to finish before freeing a session 2019-11-19 21:37:35 -05:00
soc riscv: move sifive_l2_cache.h to include/soc 2020-01-12 10:12:44 -08:00
sound ASoC: Fixes for v5.5 2019-12-17 14:18:32 +01:00
target
trace Various tracing fixes: 2020-01-23 11:23:37 -08:00
uapi io_uring-5.5-2020-01-22 2020-01-22 08:30:09 -08:00
vdso
video
xen xen/interface: re-define FRONT/BACK_RING_ATTACH() 2019-12-20 13:44:42 +01:00