Kernel NULL pointer deref. in musb_gadget on arm davinci omapl138 platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

we use a custom board with a davinci omapl138 based on 
OMAP-L138 eXperimenter Kit.
I added our board specific patches to a recent mainline linux 
kernel (version v3.6-rc2-223) to commit 
9160338de92c0305329be5163a76f849806e83de.
Using USB 2.0 with g_serial gadget driver results in kernel NULL 
pointer dereference exception in musb_g_giveback. The error occurs 
while connecting to the Host and is reproduceable.
The error occurs with gadget drivers build in and with drivers
compiled as modules.
The NULL pointer reference is caused by list_del (in include/linux/list.h)
please see the gdb listing below.

There is a last "good" patch:
e4e5b136eb6f2d3aa10dca108a1b787dc92d67df usb: musb: be careful when using 
different fifo_modes
With this patch the g_serial gadget is working as expected.

Does anybody have similarly problems or does anybody see what the problem 
might be?


Please see below the kernel error output, parts of kernel log at 
boot time, a gdb listing and board bringup code for usb.

Regards,

Bastian.


kernel NULL pointer dereference after putting the usb cable to host:

-bash-3.2# [   57.890442] Unable to handle kernel NULL pointer dereference 
at virtual address 00000004
[   57.898569] pgd = c0004000
[   57.901294] [00000004] *pgd=00000000
[   57.904915] Internal error: Oops: 5 [#1] PREEMPT ARM
[   57.909881] Modules linked in:
[   57.912968] CPU: 0    Not tainted  (3.6.0-rc2-00223-g5bbc5fb #21)
[   57.919095] PC is at musb_g_giveback+0x1c/0x120
[   57.923646] LR is at musb_g_ep0_giveback+0x1c/0x20
[   57.928452] pc : [<c029dc38>]    lr : [<c029ca2c>]    psr: 80000093
[   57.928452] sp : c06efcd0  ip : 00000000  fp : c06efd04
[   57.939907] r10: fee00400  r9 : fee00500  r8 : fee00500
[   57.945132] r7 : 00000001  r6 : c18160f8  r5 : 00000008  r4 : ffffffcc
[   57.951652] r3 : c18163a8  r2 : 00000000  r1 : ffffffcc  r0 : c1816360
[   57.958175] Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM 
Segment kernel
[   57.965562] Control: 0005317f  Table: c0c74000  DAC: 00000017
[   57.971307] Process swapper (pid: 0, stack limit = 0xc06ee270)
[   57.977138] Stack: (0xc06efcd0 to 0xc06f0000)
[   57.981515] fcc0:                                     c002dce8 00000000 
40000093 00000008
[   57.989706] fce0: c06efd2e 00000001 00000008 c18160f8 00000001 fee00500 
c06efd14 c06efd08
[   57.997897] fd00: c029ca2c c029dc2c c06efd64 c06efd18 c029d120 c029ca20 
c06efd3c c06efd28
[   58.006088] fd20: c0035988 c0035580 c1816294 06800001 00000100 c06e0040 
c0036420 00000000
[   58.014274] fd40: c18160f8 00000000 00000000 000000f0 00000099 00000008 
c06efdb4 c06efd68
[   58.022463] fd60: c029bd24 c029cd38 c06efd94 c06efd78 c0051988 e8000000 
000000f0 00000099
[   58.030649] fd80: 00000008 c1b61c00 c06efe1c 00000000 c1b61b80 c18160f8 
00080001 00000000
[   58.038838] fda0: 60000093 c0707500 c06efdfc c06efdb8 c02a35dc c029b170 
0003a980 00000000
[   58.047025] fdc0: 005fef40 00000000 fee00000 00000000 0003a980 c1b61b80 
c1b61b80 c06ee000
[   58.055211] fde0: 0000003a 00000000 00000000 c0707500 c06efe3c c06efe00 
c00627cc c02a33dc
[   58.063399] fe00: 0000000d c077b460 c0700580 00000000 c06efe44 c1b61b80 
c0707500 febfd000
[   58.071587] fe20: c06efee4 00000000 c0700580 c06efef8 c06efe54 c06efe40 
c0062a24 c0062734
[   58.079774] fe40: c0707500 00000000 c06efe6c c06efe58 c0065370 c00629d8 
c0022794 0000003a
[   58.087964] fe60: c06efe84 c06efe70 c0062354 c006525c c0023390 0000003a 
c06efe9c c06efe88
[   58.096154] fe80: c0009df4 c006232c c02c2398 00000013 c06efeac c06efea0 
c0008704 c0009d98
[   58.104342] fea0: c06eff34 c06efeb0 c0009078 c0008700 c06efef8 00000013 
75abeb0c 0000000d
[   58.112529] fec0: 74d80b77 0000000d c0700308 00000000 00000000 c0700580 
c06efef8 c06eff34
[   58.120718] fee0: c06efef8 c06efef8 c00502c8 c02c2398 00000013 ffffffff 
75abeb0c 0000000d
[   58.128905] ff00: 00000000 00e6ed3a 00000000 c06ee000 c0700580 c0700580 
00000000 c07687ec
[   58.137095] ff20: 41069265 c0700308 c06eff44 c06eff38 c02c2404 c02c2348 
c06eff64 c06eff48
[   58.145282] ff40: c02c1dfc c02c2400 c06ee000 c0700580 00000000 00000000 
c06eff8c c06eff68
[   58.153474] ff60: c02c25b4 c02c1dec c06ee000 c06f9f74 c06f9ba0 c07743d4 
c0004000 c06cf9ec
[   58.161662] ff80: c06effac c06eff90 c000a674 c02c241c 00000002 c077439c 
c06d1340 c06f9b18
[   58.169852] ffa0: c06effc4 c06effb0 c0404698 c000a604 c06d1340 c06f6ec8 
c06efff4 c06effc8
[   58.178040] ffc0: c06aa9d0 c0404634 ffffffff ffffffff c06aa280 00000000 
00000000 c06d0f3c
[   58.186228] ffe0: 00053175 c06f6018 00000000 c06efff8 c0008040 c06aa70c 
00000000 00000000
[   58.194475] [<c029dc38>] (musb_g_giveback+0x1c/0x120) from [<c029ca2c>] 
(musb_g_ep0_giveback+0x1c/0x20)
[   58.203915] [<c029ca2c>] (musb_g_ep0_giveback+0x1c/0x20) from 
[<c029d120>] (musb_g_ep0_irq+0x3f8/0xc8c)
[   58.213349] [<c029d120>] (musb_g_ep0_irq+0x3f8/0xc8c) from [<c029bd24>] 
(musb_interrupt+0xbc4/0xd98)
[   58.222530] [<c029bd24>] (musb_interrupt+0xbc4/0xd98) from [<c02a35dc>] 
(da8xx_musb_interrupt+0x210/0x2ec)
[   58.232243] [<c02a35dc>] (da8xx_musb_interrupt+0x210/0x2ec) from 
[<c00627cc>] (handle_irq_event_percpu+0xa8/0x2a4)
[   58.242633] [<c00627cc>] (handle_irq_event_percpu+0xa8/0x2a4) from 
[<c0062a24>] (handle_irq_event+0x5c/0x7c)
[   58.252505] [<c0062a24>] (handle_irq_event+0x5c/0x7c) from [<c0065370>] 
(handle_edge_irq+0x124/0x164)
[   58.261774] [<c0065370>] (handle_edge_irq+0x124/0x164) from 
[<c0062354>] (generic_handle_irq+0x38/0x40)
[   58.271209] [<c0062354>] (generic_handle_irq+0x38/0x40) from 
[<c0009df4>] (handle_IRQ+0x6c/0x90)
[   58.280029] [<c0009df4>] (handle_IRQ+0x6c/0x90) from [<c0008704>] 
(asm_do_IRQ+0x14/0x18)
[   58.288151] [<c0008704>] (asm_do_IRQ+0x14/0x18) from [<c0009078>] 
(__irq_svc+0x38/0x84)
[   58.296147] Exception stack(0xc06efeb0 to 0xc06efef8)
[   58.301216] fea0:                                     c06efef8 00000013 
75abeb0c 0000000d
[   58.309405] fec0: 74d80b77 0000000d c0700308 00000000 00000000 c0700580 
c06efef8 c06eff34
[   58.317584] fee0: c06efef8 c06efef8 c00502c8 c02c2398 00000013 ffffffff
[   58.324253] [<c0009078>] (__irq_svc+0x38/0x84) from [<c02c2398>] 
(cpuidle_wrap_enter+0x60/0xb8)
[   58.332994] [<c02c2398>] (cpuidle_wrap_enter+0x60/0xb8) from 
[<c02c2404>] (cpuidle_enter_tk+0x14/0x1c)
[   58.342335] [<c02c2404>] (cpuidle_enter_tk+0x14/0x1c) from [<c02c1dfc>] 
(cpuidle_enter_state+0x20/0x74)
[   58.351764] [<c02c1dfc>] (cpuidle_enter_state+0x20/0x74) from 
[<c02c25b4>] (cpuidle_idle_call+0x1a8/0x30c)
[   58.361457] [<c02c25b4>] (cpuidle_idle_call+0x1a8/0x30c) from 
[<c000a674>] (cpu_idle+0x80/0xf0)
[   58.370218] [<c000a674>] (cpu_idle+0x80/0xf0) from [<c0404698>] 
(rest_init+0x74/0x8c)
[   58.378130] [<c0404698>] (rest_init+0x74/0x8c) from [<c06aa9d0>] 
(start_kernel+0x2d4/0x33c)
[   58.386505] Code: e24dd014 e1a00000 e1a04001 e281c034 (e59c1004) 
[   58.392613] ---[ end trace 48691b979d3d6004 ]---
[   58.397239] Kernel panic - not syncing: Fatal exception in interrupt
[   58.403595] Rebooting in 1 seconds..OMAP-L138 initialization passed!



part of Kernel log at boot time:
[    1.952729] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.959481] ohci ohci.0: DA8xx OHCI
[    1.965474] ohci ohci.0: new USB bus registered, assigned bus number 1
[    1.972694] Waiting for USB PHY clock good...
[    1.977667] ohci ohci.0: irq 59, io mem 0x01e25000
[    2.045451] usb usb1: New USB device found, idVendor=1d6b, 
idProduct=0001
[    2.052431] usb usb1: New USB device strings: Mfr=3, Product=2, 
SerialNumber=1
[    2.059726] usb usb1: Product: DA8xx OHCI
[    2.063905] usb usb1: Manufacturer: Linux 3.6.0-rc1-00145-ga5b97e0 
ohci_hcd
[    2.071021] usb usb1: SerialNumber: ohci.0
[    2.080466] hub 1-0:1.0: USB hub found
[    2.084346] hub 1-0:1.0: 1 port detected
[    2.091411] Initializing USB Mass Storage driver...
[    2.098011] usbcore: registered new interface driver usb-storage
[    2.104351] USB Mass Storage support registered.
[    2.109050] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
[    2.119398] Waiting for USB PHY clock good...
[    2.140761] musb-hdrc musb-hdrc: MUSB HDRC host driver
[    2.147985] musb-hdrc musb-hdrc: new USB bus registered, assigned bus 
number 2
[    2.156577] usb usb2: New USB device found, idVendor=1d6b, 
idProduct=0002
[    2.163653] usb usb2: New USB device strings: Mfr=3, Product=2, 
SerialNumber=1
[    2.171074] usb usb2: Product: MUSB HDRC host driver
[    2.176087] usb usb2: Manufacturer: Linux 3.6.0-rc1-00145-ga5b97e0 
musb-hcd
[    2.183816] usb usb2: SerialNumber: musb-hdrc
[    2.193351] hub 2-0:1.0: USB hub found
[    2.197284] hub 2-0:1.0: 1 port detected
[    2.203642] musb-hdrc musb-hdrc: USB OTG mode controller at fee00000 
using PIO, IRQ 58

gdb vmlinux

(gdb) l *0xc029dc38
0xc029dc38 is in musb_g_giveback (include/linux/list.h:106).
101             __list_del(entry->prev, entry->next);
102     }
103 
104     static inline void list_del(struct list_head *entry)
105     {
106             __list_del(entry->prev, entry->next);
107             entry->next = LIST_POISON1;
108             entry->prev = LIST_POISON2;
109     }
110     #else
(gdb) 



The board bringup code related to usb is this:

        /*
         * Setup the Ref. clock frequency for the ea20 at 24 MHz.
         */
        cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
        cfgchip2 &= ~CFGCHIP2_OTGMODE;
#ifdef  CONFIG_USB_MUSB_HOST
#error "CONFIG_USB_MUSB_HOST is selcted"
        cfgchip2 |=  CFGCHIP2_FORCE_HOST;
#else
        cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
#endif
        cfgchip2 &= ~CFGCHIP2_REFFREQ;
        cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
        __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));

....
        ret = da8xx_register_usb20(255, 8);
        if (ret)
                printk("%s: USB 2.0 registration failed: %d\n",
                           __func__, ret);


What does the bringup code for usb gadgets on other davinci based boards 
look like?

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux