openwrt/target/linux
Michal Cieslakiewicz e2b89ea069 kernel: generic: 5.4: fix mtd concat panic on read/write functions
Commit 2431c4f5b46c32c4ac495456b1ef4ce59c0bb85d ("mtd: Implement
mtd_{read,write}() as wrappers around mtd_{read,write}_oob()") for kernel 5.4
restrict mtd devices to register only one type of read/write functions
(either generic or OOB).

mtd concat does not follow above rule and defines both methods at the same
time, causing this type of device to be rejected by kernel. For routers that
use mtd concat for root UBI volume that means kernel panic and boot loop with
following error:

[    0.767307] Creating 1 MTD partitions on "ubi-concat":
[    0.772547] 0x000000000000-0x000007500000 : "ubi"
[    0.777953] ------------[ cut here ]------------
[    0.782683] WARNING: CPU: 0 PID: 1 at drivers/mtd/mtdcore.c:621 add_mtd_device+0x84/0x5f4
[    0.790983] Modules linked in:
[    0.794093] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.24 #0
[    0.799932] Stack : 80680000 8062af20 00000000 00000000 8062a0f0 87c2dae4 87c282fc 8065fd23
[    0.808430]         805c64f4 00000001 807b32d8 80670000 80670000 00000001 87c2da98 25c15bcb
[    0.816909]         00000000 00000000 807e0000 0000006e 61696e74 00000000 2e342e32 34202330
[    0.825397]         0000006e cef2ada7 00000000 000c1ded 00000000 00000009 00000000 8034de64
[    0.833889]         00000009 80670000 80670000 80676d18 00000000 80320044 00000000 807b0000
[    0.842381]         ...
[    0.844861] Call Trace:
[    0.847367] [<80069994>] show_stack+0x30/0x100
[    0.851913] [<8007e8ac>] __warn+0xc0/0x10c
[    0.856072] [<8007e954>] warn_slowpath_fmt+0x5c/0xac
[    0.861134] [<8034de64>] add_mtd_device+0x84/0x5f4
[    0.866001] [<80352a50>] add_mtd_partitions+0xd8/0x1b8
[    0.871231] [<803527b8>] parse_mtd_partitions+0x238/0x3f8
[    0.876717] [<8034e51c>] mtd_device_parse_register+0x48/0x1b0
[    0.882586] [<8038dd2c>] virt_concat_probe+0x170/0x1ec
[    0.887820] [<803334c8>] platform_drv_probe+0x40/0x94
[    0.892970] [<80331638>] really_probe+0x104/0x35c
[    0.897766] [<80331d54>] device_driver_attach+0x70/0x98
[    0.903072] [<80331ddc>] __driver_attach+0x60/0x100
[    0.908042] [<8032f668>] bus_for_each_dev+0x68/0xa4
[    0.912989] [<803309d4>] bus_add_driver+0x1f0/0x200
[    0.917952] [<80332448>] driver_register+0x84/0x148
[    0.922906] [<80060a1c>] do_one_initcall+0x7c/0x1dc
[    0.927870] [<80684e14>] kernel_init_freeable+0x158/0x23c
[    0.933361] [<805387d8>] kernel_init+0x10/0xf0
[    0.937883] [<80064dd8>] ret_from_kernel_thread+0x14/0x1c
[    0.943375] ---[ end trace 62e0927fba490f68 ]---
[...]
[    2.266513] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.274893] Rebooting in 1 seconds..

This patch makes mtd concat to follow new mtd requirements by registering
either normal or oob versions of read/write functions, but not both at the
same time. OOB is used only when underlying mtd devices provide such
functionality (like NAND chips) - otherwise generic methods are used.

Tested successfully on Netgear WNDR4300.

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
2020-03-29 16:23:57 +02:00
..
apm821xx kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
ar71xx ar71xx: Fix gigabit switch support for Mikrotik RB951G-2HnD 2020-03-28 13:03:02 +01:00
arc770 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
archs38 archs38: switch to kernel 5.4 by default 2020-03-29 16:23:57 +02:00
armvirt kernel: move TEO governor to generic config 2020-03-17 00:51:48 +01:00
at91 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ath25 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ath79 kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
bcm27xx kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
bcm47xx treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
bcm53xx bcm53xx: sysupgrade: optimize building UBI image 2020-03-21 22:31:35 +01:00
bcm63xx treewide: gather DEVICE_VARS into one place 2020-03-21 19:55:12 +01:00
cns3xxx treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
gemini gemini: Bump kernel to v5.4 2020-03-21 18:17:04 +01:00
generic kernel: generic: 5.4: fix mtd concat panic on read/write functions 2020-03-29 16:23:57 +02:00
imx6 kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
ipq40xx ipq40xx: switch to 5.4 kernel 2020-03-28 13:03:02 +01:00
ipq806x kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
ipq807x treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
kirkwood kirkwood: fix DTS partitions for Pogoplug E02 2020-03-27 17:12:46 +01:00
lantiq kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
layerscape treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
malta malta: Remove kernel 4.14 support 2020-03-12 09:28:23 +01:00
mediatek mediatke: add support for elecom-wrc-2533gent 2020-03-27 16:18:57 +01:00
mpc85xx treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
mvebu mvebu: cortexa9: correct cpu subtype 2020-03-28 22:58:36 +01:00
mxs kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
octeon treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
octeontx kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
omap treewide: gather DEVICE_VARS into one place 2020-03-21 19:55:12 +01:00
oxnas kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
pistachio treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
ramips treewide: omit IMAGE_SIZE argument from check-size 2020-03-21 20:02:55 +01:00
rb532 treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
samsung treewide: remove maintainer variable from targets 2020-03-16 22:21:45 +01:00
sunxi kernel: bump 5.4 to 5.4.28 2020-03-28 13:03:02 +01:00
tegra tegra: correct cpu subtype 2020-03-28 22:58:36 +01:00
uml treewide: Remove self from MAINTAINER entries 2019-12-23 13:18:04 -08:00
x86 x86: fix missing squashfs and ext4 rootfs images 2020-03-28 13:20:05 +01:00
zynq zynq: switch to kernel 5.4 2020-03-17 00:51:48 +01:00
Makefile