Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8124936imu; Tue, 4 Dec 2018 03:26:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/WAao60t3KiBrhGlslbzz+QVanVGJjE77ssj1f6Sw6lIIP4MrEsQhXDLhhhkNJr36WcIGUz X-Received: by 2002:a62:2b8b:: with SMTP id r133mr8274893pfr.246.1543922767934; Tue, 04 Dec 2018 03:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543922767; cv=none; d=google.com; s=arc-20160816; b=hHhmHWb85z0fqlavN6McmsGDmejPqC7AEsueyhD98dzaUfURyijkjmGop2qpJKAeXE a3+QDfbOXubelMPheBdMPOlvrOw8L3MsnHibLwY90Ifw3/2j+VfyisQ2z4fkn1EqE0s8 3oMNhb1OkP4pj4A6q3wblCUl7dhZGvXCEGpQEmDUNrf1ria/Y33Gxf8wJgvuS6kmczqO JR6XKi6YMRh3FJ0wjcx1OwOqzyks28WMpN9K5alcvz976d4bumVPttpeMiGNyYW7XT9n xkLMJoU4dG2J0lXidUJlMNbkU/H+kMcKpi1FTobGw/ypO4LFNoeoOGEdBlsSyIt/zb+W DZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CfcrP7wdwDMfQZkZbsGQrMPdbmjtih+A/F60Exp5Olo=; b=H/xDkVgo/x41Fw0XMMc69soMmJk9LKsUKEqGyq+MF9W7VBAzVXoooRpIAl4u2pGXqc E9JDtm2gSW3mvX8m2vLQw0Eo6omXRFTo82PPoIXYYQDhdIfsA7vSSr7zcmEvo9CstEHN xVVYny+k9o793n6UsRjuGJQqzmb+7umdJdR2lQ1cYeVc5Y/WjMv3/OtrVIQYsklZvGvR EsrZhrIcmycWi0wxBHnKzrPcGOeptUrD8kuLoTo8lwcvy3dAawIBmFcWK+ndArgKZksk 2RqvlATvOOA0AP/+euvkiT6+CBlKq8ojRlckn0QnsJo22nXJSD6l3rJVvmh0MfCKrgsa 1F+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0rHjzJ1I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x74si18110724pfe.23.2018.12.04.03.25.52; Tue, 04 Dec 2018 03:26:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0rHjzJ1I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727289AbeLDLYB (ORCPT + 99 others); Tue, 4 Dec 2018 06:24:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:46882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeLDLBX (ORCPT ); Tue, 4 Dec 2018 06:01:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 86B60214DA; Tue, 4 Dec 2018 11:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921283; bh=6pkergr0Rc2GlUNKETl0mMF3CTcN8ft94xSI0RWeG4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0rHjzJ1INKLYmjVFKrF3p3OGCgFsv8NDc51JAEPiMVVOb+RM7yi6Gals/kKIcy81X MbTH+XVCYcyyI8MJbJUKElJYVazySMn7Gzh1NOGvhQbcweLpNJodbvX4p9lmzwGWo2 heyHKy+Y4Cdbd0JwxCHYU/oh3pMEcBkeLP7QQ+n0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Lachmann, Juergen" , Richard Weinberger , Sudip Mukherjee , Sasha Levin Subject: [PATCH 4.14 012/146] ubi: Initialize Fastmap checkmapping correctly Date: Tue, 4 Dec 2018 11:48:18 +0100 Message-Id: <20181204103727.292000416@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103726.750894136@linuxfoundation.org> References: <20181204103726.750894136@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ commit 25677478474a91fa1b46f19a4a591a9848bca6fb upstream We cannot do it last, otherwithse it will be skipped for dynamic volumes. Reported-by: Lachmann, Juergen Fixes: 34653fd8c46e ("ubi: fastmap: Check each mapping only once") Signed-off-by: Richard Weinberger Signed-off-by: Sudip Mukherjee Signed-off-by: Sasha Levin --- drivers/mtd/ubi/vtbl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 94d7a865b135..7504f430c011 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c @@ -578,6 +578,16 @@ static int init_volumes(struct ubi_device *ubi, vol->ubi = ubi; reserved_pebs += vol->reserved_pebs; + /* + * We use ubi->peb_count and not vol->reserved_pebs because + * we want to keep the code simple. Otherwise we'd have to + * resize/check the bitmap upon volume resize too. + * Allocating a few bytes more does not hurt. + */ + err = ubi_fastmap_init_checkmap(vol, ubi->peb_count); + if (err) + return err; + /* * In case of dynamic volume UBI knows nothing about how many * data is stored there. So assume the whole volume is used. @@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi, (long long)(vol->used_ebs - 1) * vol->usable_leb_size; vol->used_bytes += av->last_data_size; vol->last_eb_bytes = av->last_data_size; - - /* - * We use ubi->peb_count and not vol->reserved_pebs because - * we want to keep the code simple. Otherwise we'd have to - * resize/check the bitmap upon volume resize too. - * Allocating a few bytes more does not hurt. - */ - err = ubi_fastmap_init_checkmap(vol, ubi->peb_count); - if (err) - return err; } /* And add the layout volume */ -- 2.17.1