]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm: don't change md if dm_table_set_restrictions() fails
authorBenjamin Marzinski <bmarzins@redhat.com>
Thu, 10 Apr 2025 19:49:38 +0000 (15:49 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:14 +0000 (11:07 +0100)
commit44133e7ba86ae253ea365416e68f41235e127afb
treeb004830bc0ab3eaa8b440019b5adf1a5ea199729
parent9ace5644f5eeed1bade5b68ea960e1f0da08d25e
dm: don't change md if dm_table_set_restrictions() fails

[ Upstream commit 9eb7109a5bfc5b8226e9517e9f3cc6d414391884 ]

__bind was changing the disk capacity, geometry and mempools of the
mapped device before calling dm_table_set_restrictions() which could
fail, forcing dm to drop the new table. Failing here would leave the
device using the old table but with the wrong capacity and mempools.

Move dm_table_set_restrictions() earlier in __bind(). Since it needs the
capacity to be set, save the old version and restore it on failure.

Fixes: bb37d77239af2 ("dm: introduce zone append emulation")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm.c