Linux Device Mapper development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yang Luohan" <ylh440104@gmail.com>,
	"Mikulas Patocka" <mpatocka@redhat.com>
Cc: dm-devel@lists.linux.dev, "Mike Snitzer" <snitzer@kernel.org>,
	"Benjamin Marzinski" <bmarzins@redhat.com>
Subject: Re: [PATCH v2] dm-integrity: reject recalculation when recalc_wq was never allocated
Date: Mon, 23 Nov 2026 02:24:26 +0000	[thread overview]
Message-ID: <sashiko-outbox-228549@kernel.org> (raw)
In-Reply-To: <179540012414.2174.4959926607245086522@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm-integrity: duplicate recalculation check block in
  dm_integrity_resume()
--

commit 7fbe3dddd5b741b0cbacdf50c00c5c1e5e6e0bc0
Author: Yang Luohan <ylh440104@gmail.com>

dm-integrity: reject recalculation when recalc_wq was never allocated

This commit rejects a re-read superblock in dm_integrity_resume() when
SB_FLAG_RECALCULATING is set but ic->recalc_wq was not allocated, restoring
ic->sb from ic->sb_copy.

> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 6968e38888db9..da8d15aa414ed 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -3941,6 +3941,22 @@ static void dm_integrity_resume(struct dm_target *ti)
>  		goto skip_writes;
>  	}
>  
> +	if (unlikely(!ic->recalc_wq &&
> +		     (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)))) {
> +		memcpy(ic->sb, ic->sb_copy, sizeof(struct superblock));
> +		DMERR("Recalculate requested, but internal_hash is not used");
> +		dm_integrity_io_error(ic, "inconsistent superblock", -EINVAL);
> +		goto skip_writes;
> +	}
> +
> +	if (unlikely(!ic->recalc_wq &&
> +		     (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)))) {
> +		memcpy(ic->sb, ic->sb_copy, sizeof(struct superblock));
> +		DMERR("Recalculate requested, but internal_hash is not used");
> +		dm_integrity_io_error(ic, "inconsistent superblock", -EINVAL);
> +		goto skip_writes;
> +	}

[Severity: Low]
Was this check pasted twice by mistake?  The first block jumps to
skip_writes when the condition holds, so the second copy is dead code.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179540012414.2174.4959926607245086522@gmail.com?part=1

      reply	other threads:[~2026-11-23  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  2:15 [PATCH v2] dm-integrity: reject recalculation when recalc_wq was never allocated Yang Luohan
2026-11-23  2:24 ` sashiko-bot [this message]

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=sashiko-outbox-228549@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=mpatocka@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=snitzer@kernel.org \
    --cc=ylh440104@gmail.com \
    /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