UBI issues with lpc32xx Was: UBI issues with 5.11.11

Trevor Woerner twoerner at gmail.com
Mon Apr 12 03:29:47 BST 2021


Sorry for taking so long. Bisecting from 5.4.78 to 5.11.11 revealed a bunch of
different issues.

In my original email I jumped "to the end" of the stable releases and found an
issue with 5.11.11, but while bisecting I found things along the way.
Hopefully I've isolated the first problem. I also decided to bisect along the
Torvalds repository, hopefully that's the preferred way.

This is the issue, a NULL dereference:

	Booting Linux on physical CPU 0x0
	Linux version 5.10.0-rc6-yocto-standard (oe-user at oe-host) (arm-oe-linux-gnueabi-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.36.1.20210209) #1 PREEMPT Mon Apr 12 01:52:55 UTC 2021
	CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=0005317f
	…
	nand: device found, Manufacturer ID: 0x01, Chip ID: 0xdc
	nand: AMD/Spansion S34ML04G1
	nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
	8<--- cut here ---
	Unable to handle kernel NULL pointer dereference at virtual address 00000018
	pgd = (ptrval)
	[00000018] *pgd=00000000
	Internal error: Oops: 5 [#1] PREEMPT ARM
	CPU: 0 PID: 1 Comm: swapper Not tainted 5.10.0-rc6-yocto-standard #1
	Hardware name: LPC32XX SoC (Flattened Device Tree)
	PC is at nand_ecc_sw_hamming_correct+0x18/0x3c
	LR is at lpc32xx_nand_read_page_syndrome+0xdc/0x130
	pc : [<c02d376c>]    lr : [<c02e048c>]    psr: 20000053
	sp : c0827b78  ip : c09d5820  fp : 00000000
	r10: c0827ccc  r9 : c02d3ef8  r8 : 00000000
	r7 : c08e0828  r6 : c4850000  r5 : 00000000  r4 : c09d5820
	r3 : 00000000  r2 : c0827b9c  r1 : c08e0828  r0 : c4850000
	Flags: nzCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment none
	Control: 0005317f  Table: 80004000  DAC: 00000053
	Process swapper (pid: 1, stack limit = 0x(ptrval))
	Stack: (0xc0827b78 to 0xc0828000)
	7b60:                                                       c09d5820 c4850000
	7b80: c08e0828 c02e048c 00000000 c0039480 c06c3760 00000028 00000018 ffffffff
	7ba0: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c072170c 0000000a
	7bc0: c06fac40 c00095f8 00000001 c080f0e0 c080b000 00200140 ffff8b90 c06b7208
	7be0: c0827c10 c09d5820 c4850800 c4850000 00000800 c4850000 c02e03b0 c02d4a14
	7c00: 00000000 c004bb50 c0827ca0 00000000 0003ffc0 00000800 00000040 00000040
	7c20: 00000000 00000000 0003ffc0 00000000 00000000 00000800 00000000 00000001
	7c40: 00000001 00000000 c4850000 c09d58f8 00000000 00000000 00000000 00000000
	7c60: 0003ffc0 c09d5820 00000000 c09d5820 c0827ccc 00000000 00000000 00000000
	7c80: 1ffe0000 c02c58f0 c0827ccc c4850000 1ffe0000 c09d5820 c4850000 1ffe0000
	7ca0: 00000000 00000800 c0827ccc 00000000 c070d484 c02db644 c0827ccc 00000dc0
	7cc0: c4850000 c00bd1f4 000000dc 00000000 00000800 00000000 00000040 00000000
	7ce0: 00000000 c4850000 c4850800 c06b7208 c070d458 c09d5820 00000fff 00000fff
	7d00: c4850000 00000000 00000001 c02dc2cc 00000800 c070d458 00000001 00000000
	7d20: ffffffff 00000001 20000000 c070d484 00000006 0000024f 00000000 c09d5820
	7d40: 00000000 00000000 00000001 c4850000 000000dc c070d49c 000000dc c02dc7e0
	7d60: 000000dc 00000001 c070d458 c00cfb20 c0a4d6c0 c09d5820 c02c4804 c09d5000
	7d80: 00000000 c09d5820 00000000 00000000 00000001 00000001 000000dc 00000001
	7da0: 000000dc c02da618 00000800 00000040 00000001 00000000 00000000 00000001
	7dc0: 00000000 07bfa480 10bfb840 05953d6a c0616a89 c0616bc3 c062cf8f c062cf98
	7de0: c062cf9b c062cfa7 c0707d38 c06b7208 c0707d4c c09d5820 00000000 c08fac10
	7e00: c08fac00 07bfa480 10bfb840 05953d6a e101e101 c02e0b98 c0af2528 c0825b20
	7e20: c0701a08 e100e001 10bfb840 042fee10 00000400 c06b7208 00000001 c08fac10
	7e40: c070e1a8 00000000 c07430ec c070e1a8 00000000 c0653840 00000000 c02a0b98
	7e60: c08fac10 00000000 00000000 c029f614 00000000 c08fac10 c070e1a8 c070bf18
	7e80: c06aa838 c0721000 c0653840 c029fbb4 00000000 c08fac10 c070e1a8 c029fc78
	7ea0: c08fac10 c070e1a8 c029fbcc c029dde0 c070bf18 c080f36c c0810230 c06b7208
	7ec0: c070e1a8 c0a4d780 00000000 c029e52c c062e635 c062e63d 00000000 c070e1a8
	7ee0: ffffe000 00000000 c0721000 c02a02a4 c0699e74 ffffe000 00000000 c0683efc
	7f00: c08191ec c0618d51 00000000 c0032f00 00000001 c0653840 c06833d8 00000424
	7f20: 00000006 00000006 00000000 0000041f 00000000 c08191d5 c08191dd c06b7208
	7f40: 00000000 00000006 000000d4 c06b7208 c06aa854 00000007 000000d4 c08191a0
	7f60: c06aa858 c06841d8 00000006 00000006 00000000 c06833d8 00000000 c06b32f8
	7f80: 00000000 00000000 c053b81c 00000000 00000000 00000000 00000000 00000000
	7fa0: 00000000 c053b824 00000000 c0008520 00000000 00000000 00000000 00000000
	7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
	[<c02d376c>] (nand_ecc_sw_hamming_correct) from [<c02e048c>] (lpc32xx_nand_read_page_syndrome+0xdc/0x130)
	[<c02e048c>] (lpc32xx_nand_read_page_syndrome) from [<c02d4a14>] (nand_read_oob+0x3f0/0x610)
	[<c02d4a14>] (nand_read_oob) from [<c02c58f0>] (mtd_read_oob+0xc8/0x138)
	[<c02c58f0>] (mtd_read_oob) from [<c02db644>] (scan_read+0xcc/0x130)
	[<c02db644>] (scan_read) from [<c02dc2cc>] (search_bbt+0x168/0x26c)
	[<c02dc2cc>] (search_bbt) from [<c02dc7e0>] (nand_create_bbt+0x310/0x5c4)
	[<c02dc7e0>] (nand_create_bbt) from [<c02da618>] (nand_scan_with_ids+0x1254/0x136c)
	[<c02da618>] (nand_scan_with_ids) from [<c02e0b98>] (lpc32xx_nand_probe+0x530/0x600)
	[<c02e0b98>] (lpc32xx_nand_probe) from [<c02a0b98>] (platform_drv_probe+0x38/0x6c)
	[<c02a0b98>] (platform_drv_probe) from [<c029f614>] (really_probe+0x208/0x35c)
	[<c029f614>] (really_probe) from [<c029fbb4>] (device_driver_attach+0x44/0x5c)
	[<c029fbb4>] (device_driver_attach) from [<c029fc78>] (__driver_attach+0xac/0xb4)
	[<c029fc78>] (__driver_attach) from [<c029dde0>] (bus_for_each_dev+0x64/0xa4)
	[<c029dde0>] (bus_for_each_dev) from [<c029e52c>] (bus_add_driver+0x144/0x1a4)
	[<c029e52c>] (bus_add_driver) from [<c02a02a4>] (driver_register+0xac/0xf0)
	[<c02a02a4>] (driver_register) from [<c0683efc>] (do_one_initcall+0x74/0x194)
	[<c0683efc>] (do_one_initcall) from [<c06841d8>] (kernel_init_freeable+0x168/0x1b4)
	[<c06841d8>] (kernel_init_freeable) from [<c053b824>] (kernel_init+0x8/0xf8)
	[<c053b824>] (kernel_init) from [<c0008520>] (ret_from_fork+0x14/0x34)
	Exception stack(0xc0827fb0 to 0xc0827ff8)
	7fa0:                                     00000000 00000000 00000000 00000000
	7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
	Code: e1a00001 e1a01002 e1a02003 e59c32b8 (e5933018) 
	---[ end trace 6305df6f8c1e3f00 ]---
	Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
	---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Here's the commit via bisection:

	$ git bisect bad
	19b2ce184b9f404d6620adf667a9019e6abcae51 is the first bad commit
	commit 19b2ce184b9f404d6620adf667a9019e6abcae51
	Author: Miquel Raynal <miquel.raynal at bootlin.com>
	Date:   Wed Sep 30 01:01:20 2020 +0200

	    mtd: nand: ecc-hamming: Stop using raw NAND structures
	    
	    This code is meant to be reused by the SPI-NAND core. Now that the
	    driver has been cleaned and reorganized, use a generic ECC engine
	    object to store the driver's data instead of accessing members of the
	    nand_chip structure. This means adding proper init/cleanup helpers.
	    
	    Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
	    Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-17-miquel.raynal@bootlin.com

	 drivers/mtd/nand/ecc-sw-hamming.c       | 17 +++++----
	 drivers/mtd/nand/raw/nand_base.c        | 63 +++++++++++++++++++++++++++++++--
	 include/linux/mtd/nand-ecc-sw-hamming.h | 20 +++++++++++
	 include/linux/mtd/rawnand.h             |  2 ++
	 4 files changed, 90 insertions(+), 12 deletions(-)



More information about the linux-mtd mailing list