No description
Find a file
Yosry Ahmed 14f1992430 mm: zswap: fix missing folio cleanup in writeback race path
commit e3b63e966c upstream.

In zswap_writeback_entry(), after we get a folio from
__read_swap_cache_async(), we grab the tree lock again to check that the
swap entry was not invalidated and recycled.  If it was, we delete the
folio we just added to the swap cache and exit.

However, __read_swap_cache_async() returns the folio locked when it is
newly allocated, which is always true for this path, and the folio is
ref'd.  Make sure to unlock and put the folio before returning.

This was discovered by code inspection, probably because this path handles
a race condition that should not happen often, and the bug would not crash
the system, it will only strand the folio indefinitely.

Link: https://lkml.kernel.org/r/20240125085127.1327013-1-yosryahmed@google.com
Fixes: 04fc781608 ("mm: fix zswap writeback race condition")
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-01 13:26:39 +01:00
arch s390: use the correct count for __iowrite64_copy() 2024-03-01 13:26:37 +01:00
block block: Fix WARNING in _copy_from_iter 2024-03-01 13:26:25 +01:00
certs
crypto crypto: api - Disallow identical driver names 2024-01-31 16:16:58 -08:00
Documentation arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata 2024-02-23 09:12:52 +01:00
drivers i2c: imx: when being a target, mark the last read as processed 2024-03-01 13:26:38 +01:00
fs fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio 2024-03-01 13:26:39 +01:00
include fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio 2024-03-01 13:26:39 +01:00
init update workarounds for gcc "asm goto" issue 2024-02-23 09:12:28 +01:00
io_uring io_uring/net: fix multishot accept overflow handling 2024-02-23 09:12:43 +01:00
ipc
kernel bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel 2024-03-01 13:26:36 +01:00
lib crypto: lib/mpi - Fix unexpected pointer access in mpi_ec_init 2024-02-23 09:12:49 +01:00
LICENSES
mm mm: zswap: fix missing folio cleanup in writeback race path 2024-03-01 13:26:39 +01:00
net Fix write to cloned skb in ipv6_hop_ioam() 2024-03-01 13:26:38 +01:00
rust rust: allocator: Prevent mis-aligned allocation 2023-08-11 12:08:18 +02:00
samples work around gcc bugs with 'asm goto' with outputs 2024-02-23 09:12:28 +01:00
scripts bpf, scripts: Correct GPL license name 2024-03-01 13:26:35 +01:00
security apparmor: Free up __cleanup() name 2024-02-23 09:12:51 +01:00
sound ALSA: usb-audio: Ignore clock selector errors for single connection 2024-03-01 13:26:27 +01:00
tools net/sched: Retire dsmark qdisc 2024-03-01 13:26:24 +01:00
usr
virt kvm/vfio: ensure kvg instance stays around in kvm_vfio_group_add() 2023-09-13 09:42:46 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS genirq/affinity: Move group_cpus_evenly() into lib/ 2024-01-10 17:10:33 +01:00
Makefile Linux 6.1.79 2024-02-23 09:12:53 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.