diff options
| author | Jianyun Gao <jianyungao89@gmail.com> | 2026-07-20 11:36:32 +0800 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2026-07-20 15:37:46 +0200 |
| commit | c2e894eac398b258f12fdec73ed6ba081047f7b3 (patch) | |
| tree | 3c80a696828d15aa659dd16ca96909b79957850f /tools/perf/scripts/python/flamegraph.py | |
| parent | fb9e17287a4ea1cbbcedc77e6866978ecc2a7b55 (diff) | |
dm-pcache: fix use-after-free and invalid seg operations in kset_replay()
In kset_replay, when key->seg_gen is stale (key->seg_gen <
key->cache_pos.cache_seg->gen), cache_key_put(key) is called but then
key->cache_pos.cache_seg is accessed as the argument to cache_seg_get().
This is a use-after-free on the freed key memory. Although mempool
recycled memory is not immediately reclaimed or overwritten in practice,
this is still a potential UAF bug.
Additionally, for expired invalid keys, setting the cache->seg_map bit
and calling cache_seg_get() is unreasonable since the corresponding
segment data is no longer valid.
Fix both issues by moving cache_seg_get() and __set_bit() after the
gen check, so they only execute for valid keys, and using continue to
skip invalid keys.
Cc: stable@vger.kernel.org
Fixes: 1d57628ff95b ("dm-pcache: add persistent cache target in device-mapper")
Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
