|
@@ -757,6 +757,8 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
|
|
|
si->is_empty = 0;
|
|
si->is_empty = 0;
|
|
|
|
|
|
|
|
if (!ec_corr) {
|
|
if (!ec_corr) {
|
|
|
|
|
+ int image_seq;
|
|
|
|
|
+
|
|
|
/* Make sure UBI version is OK */
|
|
/* Make sure UBI version is OK */
|
|
|
if (ech->version != UBI_VERSION) {
|
|
if (ech->version != UBI_VERSION) {
|
|
|
ubi_err("this UBI version is %d, image version is %d",
|
|
ubi_err("this UBI version is %d, image version is %d",
|
|
@@ -778,6 +780,18 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
|
|
|
ubi_dbg_dump_ec_hdr(ech);
|
|
ubi_dbg_dump_ec_hdr(ech);
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ image_seq = be32_to_cpu(ech->ec);
|
|
|
|
|
+ if (!si->image_seq_set) {
|
|
|
|
|
+ ubi->image_seq = image_seq;
|
|
|
|
|
+ si->image_seq_set = 1;
|
|
|
|
|
+ } else if (ubi->image_seq != image_seq) {
|
|
|
|
|
+ ubi_err("bad image sequence number %d in PEB %d, "
|
|
|
|
|
+ "expected %d", image_seq, pnum, ubi->image_seq);
|
|
|
|
|
+ ubi_dbg_dump_ec_hdr(ech);
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* OK, we've done with the EC header, let's look at the VID header */
|
|
/* OK, we've done with the EC header, let's look at the VID header */
|
|
@@ -910,8 +924,6 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
|
|
|
if (si->is_empty)
|
|
if (si->is_empty)
|
|
|
ubi_msg("empty MTD device detected");
|
|
ubi_msg("empty MTD device detected");
|
|
|
|
|
|
|
|
- ubi->image_seq_set = 1;
|
|
|
|
|
-
|
|
|
|
|
/*
|
|
/*
|
|
|
* In case of unknown erase counter we use the mean erase counter
|
|
* In case of unknown erase counter we use the mean erase counter
|
|
|
* value.
|
|
* value.
|