xarray: Fix early termination of xas_for_each_marked
Matthew Wilcox (Oracle) authored
commit 7e934cf5 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 ma...
884d7304
Name Last commit Last update
..
acpi ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE
asm-generic lib/vdso: Make __arch_update_vdso_data() logic understandable
clocksource x86/hyperv: Initialize clockevents earlier in CPU onlining
crypto crypto: ablkcipher - remove deprecated and unused ablkcipher support
drm drm/shmem: add support for per object caching flags.
dt-bindings clk: imx8mn: Fix incorrect clock defines
keys Merge tag 'powerpc-5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
kunit kunit: fix failure to build without printk
kvm Merge remote-tracking branch 'kvmarm/misc-5.5' into kvmarm/next
linux xarray: Fix early termination of xas_for_each_marked
math-emu nds32: Mark expected switch fall-throughs
media media: rc: add keymap for Videostrong KII Pro
misc auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay
net rxrpc: Fix call interruptibility handling
pcmcia Merge tag 'docs-5.3' of git://git.lwn.net/linux
ras RAS: Use consistent types for UUIDs
rdma IB/core: Let IB core distribute cache update events
scsi scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session"
soc riscv: move sifive_l2_cache.h to include/soc
sound ALSA: rawmidi: Avoid bit fields for state flags
target scsi: target: Remove tpg_list and se_portal_group.se_tpg_node
trace rcu: Make rcu_barrier() account for offline no-CBs CPUs
uapi include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap
vdso vdso: Remove superfluous #ifdef __KERNEL__ in vdso/datapage.h
video fbdev: da8xx: remove panel_power_ctrl() callback from platform data
xen