linux/drivers/md/dm-pcache
Samuel Moelius d9c631e3fb dm-pcache: reject option groups without values
The pcache target parses optional arguments as name/value pairs.  A
table that advertises one optional argument and supplies only a
recognized option name, for example "cache_mode", reaches
parse_cache_opts() with argc == 1.  The parser consumes the name,
decrements argc to zero, then calls dm_shift_arg() again for the value.
dm_shift_arg() returns NULL when no arguments remain, and the following
strcmp() dereferences that NULL pointer.

Check that each recognized option has a value before consuming it.  This
keeps valid "cache_mode writeback" and "data_crc true/false" tables
unchanged while making malformed tables fail during target construction
with a precise missing-value error.

Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
Reviewed-by:  Zheng Gu <cengku@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 1d57628ff9 ("dm-pcache: add persistent cache target in device-mapper")
Cc: stable@vger.kernel.org
2026-07-08 22:33:34 +02:00
..
backing_dev.c
backing_dev.h
cache_dev.c
cache_dev.h
cache_gc.c
cache_key.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
cache_req.c dm-pcache: allow built-in build and rename flush helper 2025-11-18 19:01:47 +01:00
cache_segment.c dm pcache: fix segment info indexing 2025-12-10 19:28:23 +01:00
cache_writeback.c
cache.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
cache.h dm-pcache: allow built-in build and rename flush helper 2025-11-18 19:01:47 +01:00
dm_pcache.c dm-pcache: reject option groups without values 2026-07-08 22:33:34 +02:00
dm_pcache.h
Kconfig
Makefile dm-pcache: allow built-in build and rename flush helper 2025-11-18 19:01:47 +01:00
pcache_internal.h dm-pcache: reuse meta_addr in pcache_meta_find_latest 2025-11-18 19:01:57 +01:00
segment.c
segment.h