From: Benjamin Marzinski <bmarzins@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
dm-devel@lists.linux.dev
Subject: Re: [PATCH] dm: fix unlocked test for dm_suspended_md
Date: Thu, 8 Jan 2026 15:41:35 -0500 [thread overview]
Message-ID: <aWAWf7ays5fU4sj1@redhat.com> (raw)
In-Reply-To: <daf004a4-e171-8225-4d14-f0cfb3ce9b22@redhat.com>
On Thu, Jan 08, 2026 at 08:55:08PM +0100, Mikulas Patocka wrote:
> The function dm_blk_report_zones tests if the device is suspended with
> the "dm_suspended_md" call. However, this function is called without
> holding any locks, so the device may be suspended just after it.
>
> Move the call to dm_suspended_md after dm_get_live_table, so that the
> device can't be suspended after the suspended state was tested.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Fixes: 37f53a2c60d0 ("dm: fix dm_blk_report_zones")
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
>
> ---
> drivers/md/dm-zone.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> Index: linux-2.6/drivers/md/dm-zone.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/dm-zone.c 2026-01-06 15:55:41.000000000 +0100
> +++ linux-2.6/drivers/md/dm-zone.c 2026-01-06 22:55:36.000000000 +0100
> @@ -60,11 +60,13 @@ int dm_blk_report_zones(struct gendisk *
> * Zone revalidation during __bind() is in progress, but this
> * call is from a different process
> */
> - if (dm_suspended_md(md))
> - return -EAGAIN;
> -
> map = dm_get_live_table(md, &srcu_idx);
> put_table = true;
> +
> + if (dm_suspended_md(md)) {
> + ret = -EAGAIN;
> + goto do_put_table;
> + }
> } else {
> /* Zone revalidation during __bind() */
> map = zone_revalidate_map;
> @@ -79,6 +81,7 @@ int dm_blk_report_zones(struct gendisk *
> ret = dm_blk_do_report_zones(md, map, nr_zones, &dm_args);
> }
>
> +do_put_table:
> if (put_table)
> dm_put_live_table(md, srcu_idx);
>
prev parent reply other threads:[~2026-01-08 20:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 19:55 [PATCH] dm: fix unlocked test for dm_suspended_md Mikulas Patocka
2026-01-08 20:41 ` Benjamin Marzinski [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=aWAWf7ays5fU4sj1@redhat.com \
--to=bmarzins@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.