Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53c06e0d authored by Yu Kuai's avatar Yu Kuai Committed by Greg Kroah-Hartman
Browse files

dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths



[ Upstream commit bae3028799dc4f1109acc4df37c8ff06f2d8f1a0 ]

In the error paths 'bad_stripe_cache' and 'bad_check_reshape',
'reconfig_mutex' is still held after raid_ctr() returns.

Fixes: 9dbd1aa3 ("dm raid: add reshaping support to the target")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9ebcca93
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -3284,15 +3284,19 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
	/* Try to adjust the raid4/5/6 stripe cache size to the stripe size */
	if (rs_is_raid456(rs)) {
		r = rs_set_raid456_stripe_cache(rs);
		if (r)
		if (r) {
			mddev_unlock(&rs->md);
			goto bad_stripe_cache;
		}
	}

	/* Now do an early reshape check */
	if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) {
		r = rs_check_reshape(rs);
		if (r)
		if (r) {
			mddev_unlock(&rs->md);
			goto bad_check_reshape;
		}

		/* Restore new, ctr requested layout to perform check */
		rs_config_restore(rs, &rs_layout);
@@ -3301,6 +3305,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
			r = rs->md.pers->check_reshape(&rs->md);
			if (r) {
				ti->error = "Reshape check failed";
				mddev_unlock(&rs->md);
				goto bad_check_reshape;
			}
		}