Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3563469pxb; Mon, 1 Mar 2021 13:28:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyL/d/hvW1GJQClsrQTih5Z/HjOkHG91YuWlmr5KMoNhy8VNdEA91ZDd56Tbh2G+Z3UuEt1 X-Received: by 2002:a17:907:2953:: with SMTP id et19mr17420593ejc.527.1614634102021; Mon, 01 Mar 2021 13:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614634102; cv=none; d=google.com; s=arc-20160816; b=hBPj8pGGzOeAcM8VKSsEJaPqEilVV4ZAztvyZWgWUmSLrE5g/71BObjSVwVcF5fB9a OqISWGt8QBf1ItVld/8GByEL9W9ZYIpo6zJ9A5r3sqjFN4hU/fqnP34ImyN+Kg69QpUq nOPQLPrBwBJZ6LKh74f1U/bzzRmcSp6p9fBrrMajFUhAMIQ08iHLV9HEP+/2pC8q3H5Y Xd+5Ztrlt49wj9APXt1NMNFYACom5gbqQOqWBJ3OAXfIre4s6iI8LZe1ZcAFgAUxnqet yX65AltaT2AiscfpnUdf981AxqIv2XGv2DtN178d1+l/NvS5/oWU63gsVG/k4hrn0y4M pnDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SwYPjnlGDqaR3fByBcO8mMzDAHp8hLNZEECB52ZWGPs=; b=OU2sy2RsaKcNfrer2PF4SmujxwYO03L2WiXeNoG9/VbZDyxl9rz1HSvEDnyZG4zxmN sfZ/gzhCsxv69e5b9OFSbniBt4L7Dfyf3hlF24OpDTe/SlizQEvxxzRlMMvb6UnQof9+ ErXJSM8Vq9dOCFtlRLnkpatcSETWzFFfEI1+orCqkfxYP5wwo8ClgXHuIvTnCIR5GGVa GhoLW3M47i7GrVeECa9VA6/AsLEvk+2ZlzmRYJtp3bYQvOPBEfwPj7GY/4zPkNDbEaL3 4eEIB9ntwyHORWB+AXFyNXtBpaDaps/QY6XFfHklE+cUnCJs9xk3QIsRhox+l42V49uB 9gSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EiOaQ4nJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga42si13579408ejc.8.2021.03.01.13.27.59; Mon, 01 Mar 2021 13:28:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EiOaQ4nJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244591AbhCAVYS (ORCPT + 99 others); Mon, 1 Mar 2021 16:24:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237825AbhCARQD (ORCPT ); Mon, 1 Mar 2021 12:16:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFAA665051; Mon, 1 Mar 2021 16:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617188; bh=ow61ZDxBFEupd1XCEa5kWgb8gUKNiRyWQgrKiVxPjFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiOaQ4nJJ9eFJKTYP+Mv85L423HsyBbV69Rlmr2K/AD5evJj4zFKHeH+4s/JWpyqj XdZtqVEN6+TagDy80W19+UETkKc/edfukTESDA6GBLK9eMebTicFazbO6BJaOwsrL/ lyoZKOQoaUpiVR+lGq64fp6SlvmnqsnI1brbjXxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikos Tsironis , Ming-Hung Tsai , Mike Snitzer Subject: [PATCH 4.19 234/247] dm era: Verify the data block size hasnt changed Date: Mon, 1 Mar 2021 17:14:14 +0100 Message-Id: <20210301161043.157832452@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikos Tsironis commit c8e846ff93d5eaa5384f6f325a1687ac5921aade upstream. dm-era doesn't support changing the data block size of existing devices, so check explicitly that the requested block size for a new target matches the one stored in the metadata. Fixes: eec40579d84873 ("dm: add era target") Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Nikos Tsironis Reviewed-by: Ming-Hung Tsai Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-era-target.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/md/dm-era-target.c +++ b/drivers/md/dm-era-target.c @@ -563,6 +563,15 @@ static int open_metadata(struct era_meta } disk = dm_block_data(sblock); + + /* Verify the data block size hasn't changed */ + if (le32_to_cpu(disk->data_block_size) != md->block_size) { + DMERR("changing the data block size (from %u to %llu) is not supported", + le32_to_cpu(disk->data_block_size), md->block_size); + r = -EINVAL; + goto bad; + } + r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION, disk->metadata_space_map_root, sizeof(disk->metadata_space_map_root), @@ -574,7 +583,6 @@ static int open_metadata(struct era_meta setup_infos(md); - md->block_size = le32_to_cpu(disk->data_block_size); md->nr_blocks = le32_to_cpu(disk->nr_blocks); md->current_era = le32_to_cpu(disk->current_era);