Bug 111701

Summary: kernel BUG at drivers/mtd/nand/nand_base.c:4413!
Product: Drivers Reporter: Stuart Winter (mozes)
Component: Flash/Memory Technology DevicesAssignee: David Woodhouse (dwmw2)
Status: NEW ---    
Severity: normal CC: nickkrause, szg00000
Priority: P1    
Hardware: ARM   
OS: Linux   
Kernel Version: 4.4.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg output
Kernel config for linux 4.4.1

Description Stuart Winter 2016-02-01 20:10:01 UTC
Created attachment 202681 [details]
dmesg output

This is on the Kirkwood platform, running on a Sheevaplug.  
I first observed this problem with Linux 4.4.0.  Linux 4.3.4 works fine.

[    5.819685] scsi 0:0:0:0: Direct-Access     ST380011 A                0000 PQ: 0 ANSI: 0
[    5.838242] scsi 0:0:0:0: Attached scsi generic sg0 type 0
[    5.859537] nand: nand_scan called with NULL mtd->owner!
[    5.864921] ------------[ cut here ]------------
[    5.869558] kernel BUG at drivers/mtd/nand/nand_base.c:4413!
[    5.875236] Internal error: Oops - BUG: 0 [#1] ARM
[    5.880047] Modules linked in: orion_nand(+) sata_mv mv643xx_eth ums_onetouch ums_jumpshot ums_alauda ums_sddr55 ums_sddr09 ums_isd200 ums_freecom ums_usbat ums_cypress ohci_hcd usbhid hid uhci_hcd ehci_pci ehci_orion ehci_hcd libata mmc_b
lock mmc_core usb_storage usbcore usb_common sg scsi_mod binfmt_misc vfat cdrom xfs crc32c_generic libcrc32c reiserfs nfs lockd grace sunrpc jfs fat ext4 jbd2 ext2 mbcache cifs fscache nls_base md_mod dm_mod xgifb(C) cfbfillrect cfbimgblt cfb
copyarea
[    5.923609] CPU: 0 PID: 126 Comm: modprobe Tainted: G         C      4.4.1-armv5 #2
[    5.931296] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[    5.937585] task: c2f6c840 ti: c2f58000 task.ti: c2f58000
[    5.943011] PC is at nand_scan+0x34/0x68
[    5.946949] LR is at nand_scan+0x34/0x68
[    5.950884] pc : [<c02793c8>]    lr : [<c02793c8>]    psr: 60000013
[    5.950884] sp : c2f59d38  ip : 60000013  fp : c3051008
[    5.962409] r10: 00000000  r9 : c2d62b50  r8 : df4c5c00
[    5.967650] r7 : e09d6000  r6 : c2ee4a20  r5 : 00000001  r4 : c2d62b50
[    5.974208] r3 : c0512ca4  r2 : c0512ca4  r1 : 00000000  r0 : 0000002c
[    5.980766] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    5.987933] Control: 0005397f  Table: 02f44000  DAC: 00000051
[    5.993696] Process modprobe (pid: 126, stack limit = 0xc2f58190)
[    5.999808] Stack: (0xc2f59d38 to 0xc2f5a000)
[    6.004180] 9d20:                                                       c2ee4a10 c2d62810
[    6.012398] 9d40: c2ee4a20 bf0061f0 df4c8870 c047a847 c2d76960 00000019 00000000 00000000
[    6.020613] 9d60: ffffffed df4c5c10 bf00237c bf00237c 00000009 00000001 c3051024 c0247eb8
[    6.028827] 9d80: df4c5c10 00000000 c05a29b0 c02465e8 df4c5c10 df4c5c44 bf00237c c052f908
[    6.037041] 9da0: c050ce80 c02467dc 00000000 bf00237c c0246774 c0244f20 df43140c df4c7210
[    6.045255] 9dc0: bf00237c 00000000 c2f67420 c0245dac bf00235a bf00235b 0000006f bf00237c
[    6.053469] 9de0: bf006290 00000000 c050ce80 c02470c8 bf002368 bf006290 00000000 c0248228
[    6.061684] 9e00: c3051cc0 bf006290 00000000 c00096f8 df42a000 bf002428 c0524e58 c059df88
[    6.069898] 9e20: c037c668 00000000 c2ee47c0 c01bf980 df42a000 c2f59e48 dfc57620 00000000
[    6.078112] 9e40: 000000ba dfbf9000 dfc57620 00000000 c3051008 c00d2070 df401f00 024000c0
[    6.086326] 9e60: bf0023e0 bf0023e0 00000001 c2ee4280 bf002428 c3051000 00000001 c009cf9c
[    6.094540] 9e80: bf0023e0 000059d1 c2f59f48 00000001 bf0023e0 c0060900 bf0023ec 00007fff
[    6.102755] 9ea0: 00000000 c005e2d0 00000000 c005df04 0000004e 0000004e e09d4de8 c037d4a0
[    6.110968] 9ec0: c2f59edc bf0025bc 0002b028 00000002 c2ee4260 00400000 00a04308 c00c6db0
[    6.119182] 9ee0: c2ee4280 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    6.127396] 9f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    6.135612] 9f20: 00000000 00001e38 b6907e40 00000000 e09d4e38 0002b028 c2f58000 00000051
[    6.143826] 9f40: 00a04308 c0060e74 e09d3000 00001e38 e09d4938 e09d3e61 e09d4490 000005e0
[    6.152039] 9f60: 00000670 00000000 00000000 00000000 0000001e 0000001f 00000017 00000014
[    6.160253] 9f80: 00000012 00000000 00000000 b6906008 00040000 00000080 c000a444 c2f58000
[    6.168469] 9fa0: 00000000 c000a2a0 00000000 b6906008 b6906008 00001e38 0002b028 00000000
[    6.176682] 9fc0: 00000000 b6906008 00040000 00000080 0002b028 00000000 00000000 00a04308
[    6.184897] 9fe0: b6df1c30 beafea08 00020064 b6df1c40 60000010 b6906008 00000000 00000000
[    6.193125] [<c02793c8>] (nand_scan) from [<bf0061f0>] (orion_nand_probe+0x1f0/0x290 [orion_nand])
[    6.202151] [<bf0061f0>] (orion_nand_probe [orion_nand]) from [<c0247eb8>] (platform_drv_probe+0x50/0xa0)
[    6.211770] [<c0247eb8>] (platform_drv_probe) from [<c02465e8>] (driver_probe_device+0x110/0x29c)
[    6.220686] [<c02465e8>] (driver_probe_device) from [<c02467dc>] (__driver_attach+0x68/0x8c)
[    6.229161] [<c02467dc>] (__driver_attach) from [<c0244f20>] (bus_for_each_dev+0x68/0x8c)
[    6.237375] [<c0244f20>] (bus_for_each_dev) from [<c0245dac>] (bus_add_driver+0xcc/0x1e8)
[    6.245591] [<c0245dac>] (bus_add_driver) from [<c02470c8>] (driver_register+0x9c/0xe0)
[    6.253629] [<c02470c8>] (driver_register) from [<c0248228>] (__platform_driver_probe+0x4c/0xa4)
[    6.262454] [<c0248228>] (__platform_driver_probe) from [<c00096f8>] (do_one_initcall+0x104/0x1c4)
[    6.271458] [<c00096f8>] (do_one_initcall) from [<c009cf9c>] (do_init_module+0x58/0x1bc)
[    6.279589] [<c009cf9c>] (do_init_module) from [<c0060900>] (load_module+0x175c/0x1bb4)
[    6.287626] [<c0060900>] (load_module) from [<c0060e74>] (SyS_init_module+0x11c/0x13c)
[    6.295579] [<c0060e74>] (SyS_init_module) from [<c000a2a0>] (ret_fast_syscall+0x0/0x38)
[    6.303707] Code: 0a000003 e59f1030 e59f0030 ebf88eae (e7f001f2)
[    6.309824] ---[ end trace 3b5c4710fc34c1ce ]---
Comment 1 Stuart Winter 2016-02-01 20:11:48 UTC
Created attachment 202691 [details]
Kernel config for linux 4.4.1
Comment 2 nickkrause 2016-03-25 04:22:19 UTC
Try moving this line:
  mtd = nand_to_mtd(nc);
Below these two lines:
 nand_set_controller_data(nc, board)
 nand_set_flash_node(nc, pdev->dev.of_node);
for the function,  orion_nand_probe in the file, drivers/mtd/nand/orion_nand.c. The path I am stating is from the root directory of the kernel source tree.
Comment 3 Stuart Winter 2016-03-26 10:13:50 UTC
Hi Nick

I'm puzzled:

mozes@courgette:/tmp/linux-4.4.1$ grep -ri "nand_to_mtd" .
mozes@courgette:/tmp/linux-4.4.1$ grep -ri "nand_set_flash_node" .
mozes@courgette:/tmp/linux-4.4.1$

Which Kernel tree are you looking at? This is the virgin kernel from kernel.org.
Comment 4 nickkrause 2016-03-26 17:22:05 UTC
I am looking at 4.6 mainline but this is the function name you can try and grep for orion_nand_probe.