Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1421646 > unrolled thread

[PATCH 5/7] ubi: Check whether the Fastmap anchor matches the super block

Started byRichard Weinberger <richard@nod.at>
First post2016-06-14 10:20 +0200
Last post2016-06-14 10:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/7] ubi: Check whether the Fastmap anchor matches the super block Richard Weinberger <richard@nod.at> - 2016-06-14 10:20 +0200

#1421646 — [PATCH 5/7] ubi: Check whether the Fastmap anchor matches the super block

FromRichard Weinberger <richard@nod.at>
Date2016-06-14 10:20 +0200
Subject[PATCH 5/7] ubi: Check whether the Fastmap anchor matches the super block
Message-ID<rJRJL-2cK-3@gated-at.bofh.it>
This helps to detect cases where an user copies an UBI image to
another target with different bad blocks.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/fastmap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 12bdb09..b66cb3e 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -975,6 +975,13 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
 			goto free_hdr;
 		}
 
+		if (i == 0 && pnum != fm_anchor) {
+			ubi_err(ubi, "Fastmap anchor PEB mismatch: PEB: %i vs. %i",
+				pnum, fm_anchor);
+			ret = UBI_BAD_FASTMAP;
+			goto free_hdr;
+		}
+
 		ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
 		if (ret && ret != UBI_IO_BITFLIPS) {
 			ubi_err(ubi, "unable to read fastmap block# %i EC (PEB: %i)",
-- 
2.7.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web