Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp732891imm; Thu, 13 Sep 2018 07:00:18 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdazsev3ZgcyxVTeoS19l5R4Yp6z8zlXsPMobF85n/06aNUEQO2uVzgiZ9gSVeqaLaedkgO2 X-Received: by 2002:a63:2701:: with SMTP id n1-v6mr7343366pgn.146.1536847218432; Thu, 13 Sep 2018 07:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847218; cv=none; d=google.com; s=arc-20160816; b=zD1AXMFheobRXubxXEwN3Ngw+OaLxt7wSTZbj16DoQsdo1HH9fHx3axF4Kkhc2KZkQ 4O8nx7k/dCpRaiLvRwjW1P6ojojw+98/LEhVJ8YjnvCWNJW3JhDaJ3kQC/aGFN7NcSqO ABQ7+2a2mS8pOq1S5q7NPTvOZhw6pYvWYQr++hj3TfO+fo8+LgVIwuVigCBcyVl/O+DG 0O0VMMu7PArzmXeknKb289Z8PfAptOHOX6rf44mRpJ/BI51wbex83sx4P6VSfLXe/1qt JytZzlzF6RQDsJlnzxOnc4V0UQQNdoheAsdw+pq3IUYd3t0S2xbiBggPD1loHY2ybJFl cXMQ== 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; bh=s/lNsJHrZodOi94q9jdXaU2VHJCBRdgvfBa02i4WFrQ=; b=v+HgIhGmWUmIb2nAPLpg/Rny1KCBSUJnRYy3jVmWFInVXGAZj9uVejp722yXyTMAfh /LfLN9FNHrbAU68ugKnG2ofZAD84G4ixILlIPnZV30net/LgyQKp1O96Pd/KQXAuXdgS rT07eiRHjbO/fSQbAcoJA5xv1QHOXfeXcr6USPhW+5l5Fho87/hGRNs+12D7194fweUF 6enM+BMHRC45Bz50QL9GazpUKgLamfQAVSjqEsbQ0SkqMYpgOTGhoZ8OVdvmB+LAINC4 61sCkoFj/ZMN/xzTN1Pc1UQjK4BkQ1CY4wgVqrusDbwfEwZaznVKoFZBRXYYAX2uMY0R ytNw== ARC-Authentication-Results: i=1; mx.google.com; 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 m14-v6si3869122pfh.92.2018.09.13.07.00.03; Thu, 13 Sep 2018 07:00:18 -0700 (PDT) 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; 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 S1731591AbeIMTIV (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34696 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbeIMTIU (ORCPT ); Thu, 13 Sep 2018 15:08:20 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6027BD0E; Thu, 13 Sep 2018 13:58:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Lachmann, Juergen" , Richard Weinberger , Sasha Levin Subject: [PATCH 4.18 077/197] ubi: Initialize Fastmap checkmapping correctly Date: Thu, 13 Sep 2018 15:30:26 +0200 Message-Id: <20180913131844.606589126@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Weinberger [ Upstream commit 25677478474a91fa1b46f19a4a591a9848bca6fb ] 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: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/ubi/vtbl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c @@ -579,6 +579,16 @@ static int init_volumes(struct ubi_devic 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_devic (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 */