mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Wang <x-professor@outlook.com>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: "dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	Yingjie Wang <x-professor@outlook.com>
Subject: [PATCH v2 0/3] dm zoned: fix the validation of the superblocks
Date: Thu, 3 Dec 2026 09:02:41 +0000	[thread overview]
Message-ID: <20261203090240.1180833-1-x-professor@outlook.com> (raw)

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@outlook.com/

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


             reply	other threads:[~2026-12-03  9:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:02 Yingjie Wang [this message]
2026-12-03  9:02 ` [PATCH v2 1/3] dm zoned: do not update metadata state from an invalid superblock Yingjie Wang
2026-12-03  9:02 ` [PATCH v2 2/3] dm zoned: validate the metadata layout in the superblock Yingjie Wang
2026-12-03  9:03 ` [PATCH v2 3/3] dm zoned: handle labels that are not NUL-terminated Yingjie Wang
2026-12-04  7:42   ` Damien Le Moal
2026-12-05  6:21     ` Yingjie Wang
2026-12-05 23:35       ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203090240.1180833-1-x-professor@outlook.com \
    --to=x-professor@outlook.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=hare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®