mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
b3f95490b9
This adds initial support for kernel 4.14 based on the patches for kernel 4.9. In the configuration I deactivated some of the new possible security features like: CONFIG_REFCOUNT_FULL CONFIG_SLAB_FREELIST_HARDENED CONFIG_SOFTLOCKUP_DETECTOR CONFIG_WARN_ALL_UNSEEDED_RANDOM And these overlay FS options are also deactivated: CONFIG_OVERLAY_FS_INDEX CONFIG_OVERLAY_FS_REDIRECT_DIR I activated this: CONFIG_FORTIFY_SOURCE CONFIG_POSIX_TIMERS CONFIG_SLAB_MERGE_DEFAULT CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED I am not sure if I did the porting correct for the following patches: target/linux/generic/backport-4.14/020-backport_netfilter_rtcache.patch target/linux/generic/hack-4.14/220-gc_sections.patch target/linux/generic/hack-4.14/321-powerpc_crtsavres_prereq.patch target/linux/generic/pending-4.14/305-mips_module_reloc.patch target/linux/generic/pending-4.14/611-netfilter_match_bypass_default_table.patch target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
68 lines
1.7 KiB
Diff
68 lines
1.7 KiB
Diff
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
|
Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating offsets
|
|
|
|
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
|
---
|
|
|
|
--- a/drivers/mtd/parsers/parser_trx.c
|
|
+++ b/drivers/mtd/parsers/parser_trx.c
|
|
@@ -29,6 +29,33 @@ struct trx_header {
|
|
uint32_t offset[3];
|
|
} __packed;
|
|
|
|
+/*
|
|
+ * Calculate real end offset (address) for a given amount of data. It checks
|
|
+ * all blocks skipping bad ones.
|
|
+ */
|
|
+static size_t parser_trx_real_offset(struct mtd_info *mtd, size_t bytes)
|
|
+{
|
|
+ size_t real_offset = 0;
|
|
+
|
|
+ if (mtd_block_isbad(mtd, real_offset))
|
|
+ pr_warn("Base offset shouldn't be at bad block");
|
|
+
|
|
+ while (bytes >= mtd->erasesize) {
|
|
+ bytes -= mtd->erasesize;
|
|
+ real_offset += mtd->erasesize;
|
|
+ while (mtd_block_isbad(mtd, real_offset)) {
|
|
+ real_offset += mtd->erasesize;
|
|
+
|
|
+ if (real_offset >= mtd->size)
|
|
+ return real_offset - mtd->erasesize;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ real_offset += bytes;
|
|
+
|
|
+ return real_offset;
|
|
+}
|
|
+
|
|
static const char *parser_trx_data_part_name(struct mtd_info *master,
|
|
size_t offset)
|
|
{
|
|
@@ -83,21 +110,21 @@ static int parser_trx_parse(struct mtd_i
|
|
if (trx.offset[2]) {
|
|
part = &parts[curr_part++];
|
|
part->name = "loader";
|
|
- part->offset = trx.offset[i];
|
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
|
i++;
|
|
}
|
|
|
|
if (trx.offset[i]) {
|
|
part = &parts[curr_part++];
|
|
part->name = "linux";
|
|
- part->offset = trx.offset[i];
|
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
|
i++;
|
|
}
|
|
|
|
if (trx.offset[i]) {
|
|
part = &parts[curr_part++];
|
|
part->name = parser_trx_data_part_name(mtd, trx.offset[i]);
|
|
- part->offset = trx.offset[i];
|
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
|
i++;
|
|
}
|
|
|