]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dm-pcache: zero cache_info before default init
authorLi Chen <chenl311@chinatelecom.cn>
Tue, 11 Nov 2025 12:13:36 +0000 (20:13 +0800)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 18 Nov 2025 18:02:08 +0000 (19:02 +0100)
commita6ee8422b4f2a591de010f4e60471060b13d4170
tree6e63c2a9661c33a000622882f780aa3c4eafb790
parent840b80af74fda9672f111023ca17ad7875427f13
dm-pcache: zero cache_info before default init

pcache_meta_find_latest() leaves whatever it last copied into the
caller’s buffer even when it returns NULL. For cache_info_init(),
that meant cache->cache_info could still contain CRC-bad garbage when
no valid metadata exists, leading later initialization paths to read
bogus flags.

Explicitly memset cache->cache_info in cache_info_init_default()
so new-cache paths start from a clean slate. The default sequence
number assignment becomes redundant with this reset, so it drops out.

Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
Reviewed-by: Zheng Gu <cengku@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-pcache/cache.c