[PATCH v2 0/3] dm zoned: fix the validation of the superblocks

From: Yingjie Wang

Date: Thu Dec 03 2026 - 04:02:49 EST


Patch 1 fixes dmz_check_sb() changing the metadata version, UUIDs and
label before it knows that the superblock is valid. An invalid
secondary superblock can thereby make the volume unusable.

Patch 2 adds the missing checks of the metadata layout. Without them, a
superblock with inconsistent sizes can result in an out-of-bounds write
when the table is loaded, and in metadata being written over data.

Patch 3 fixes a crash if the label is not NUL-terminated.

Tested with KASAN on null_blk devices, including fault injection, a
32-bit kernel, and volumes formatted with all dmzadm releases. All of
these problems were reproduced without the series and are gone with it.

Changes in v2:
- Patch 3: the code is unchanged. Fix the commit message: dmzadm 2.0.0
to 2.1.3 do create labels that are not NUL-terminated (Damien).
- Add Damien's Reviewed-by to patches 1 and 2.

v1: https://lore.kernel.org/dm-devel/20261201105558.117053-1-x-professor@xxxxxxxxxxx/

Yingjie Wang (3):
dm zoned: do not update metadata state from an invalid superblock
dm zoned: validate the metadata layout in the superblock
dm zoned: handle labels that are not NUL-terminated

drivers/md/dm-zoned-metadata.c | 64 ++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 19 deletions(-)


base-commit: 2ee78e96ca1894cbfe00eff1e4ff24a93215337f
--
2.43.0