Skip to content

USB driver (cdc_acm) causes kernel crash in 4.19.118 and 5.4.51 #3728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xyklex opened this issue Jul 16, 2020 · 2 comments
Closed

USB driver (cdc_acm) causes kernel crash in 4.19.118 and 5.4.51 #3728

xyklex opened this issue Jul 16, 2020 · 2 comments

Comments

@xyklex
Copy link

xyklex commented Jul 16, 2020

Is this the right place for my bug report?
Yes, I think something was added/changed after kernel v4.14.114 that could be causing this issue.

Describe the bug
Kernel panic after connecting more than one USB device

To reproduce
Have these two devices:

  • A STM32 board with ST-LINK/V2.1
  • WiFi Dongle D-Link (DWA-181) with driver from here and compiled against the kernels 4.19.118 and 5.4.51
  • Raspbian 10 (buster)
  • RPi Firmware for respective 4.19.118 and 5.4.51 versions
  • Raspberry Pi 3B+
    List the steps required to reproduce the issue.

Boot 1:
Devices Connected to the RPi board:

  • UART serial for terminal
  • Ethernet cable (rpi act as a dhcp server and router with dnsmasq)

After boot I connected the ST board and kernel recognizes it without any error

$ lsusb
Bus 001 Device 004: ID 0483:374b STMicroelectronics ST-LINK/V2.1
Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[  970.356243] usb 1-1.3: new full-speed USB device number 7 using dwc_otg
[  970.496287] usb 1-1.3: New USB device found, idVendor=0483, idProduct=374b, bcdDevice= 1.00
[  970.496305] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  970.496314] usb 1-1.3: Product: STM32 STLink
[  970.496323] usb 1-1.3: Manufacturer: STMicroelectronics
[  970.496332] usb 1-1.3: SerialNumber: 066BFF535156827867092537
[  970.552455] usb-storage 1-1.3:1.1: USB Mass Storage device detected
[  970.553356] scsi host0: usb-storage 1-1.3:1.1
[  970.554810] cdc_acm 1-1.3:1.2: ttyACM0: USB ACM device
[  971.593812] scsi 0:0:0:0: Direct-Access     MBED     microcontroller  1.0  PQ: 0 ANSI: 2
[  971.594393] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  971.595164] sd 0:0:0:0: [sda] 4168 512-byte logical blocks: (2.13 MB/2.04 MiB)
[  971.595640] sd 0:0:0:0: [sda] Write Protect is off
[  971.595647] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[  971.596018] sd 0:0:0:0: [sda] No Caching mode page found
[  971.596025] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  971.655196] sd 0:0:0:0: [sda] Attached SCSI removable disk

Next step I proceed to connect the D-Link WiFi dongle but get this errors

[ 1083.613772] usb 1-1.1.2: new high-speed USB device number 8 using dwc_otg
[ 1083.744966] usb 1-1.1.2: New USB device found, idVendor=2001, idProduct=331e, bcdDevice= 2.10
[ 1083.744981] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1083.744990] usb 1-1.1.2: Product: 802.11ac NIC
[ 1083.744999] usb 1-1.1.2: Manufacturer: Realtek
[ 1083.745008] usb 1-1.1.2: SerialNumber: 123456
[ 1083.746760] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case

[ 1084.254513] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case

[ 1084.763857] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case

[ 1085.273945] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case

[ 1085.783842] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case

[ 1086.393753] usb 1-1.1.2: reset high-speed USB device number 8 using dwc_otg

Network interfaces (ethernet, onboard wifi) are still usable but there's not the new wifi interface.

Boot 2:
Devices Connected to the RPi board:

  • UART serial for terminal
  • Ethernet cable (rpi act as a dhcp server and router with dnsmasq)

After boot I proceed to connect the D-Link WiFi dongle

$ lsusb
Bus 001 Device 006: ID 2001:331e D-Link Corp.
Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[  870.330842] usb 1-1.1.2: USB disconnect, device number 4
[  870.431284] FAT-fs (sda): unable to read boot sector to mark fs as dirty
[  873.581127] usb 1-1.3: new high-speed USB device number 6 using dwc_otg
[  873.712211] usb 1-1.3: New USB device found, idVendor=2001, idProduct=331e, bcdDevice= 2.10
[  873.712229] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  873.712239] usb 1-1.3: Product: 802.11ac NIC
[  873.712248] usb 1-1.3: Manufacturer: Realtek
[  873.712258] usb 1-1.3: SerialNumber: 123456
[  874.998262] 88x2bu: loading out-of-tree module taints kernel.
[  875.550845] usbcore: registered new interface driver rtl88x2bu
[  876.557924] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  877.568872] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  877.582407] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  877.710997] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  880.600374] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
[  884.871250] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready

It is recognized and interface wlan1 starts working, all the system is working.

I proceed to connect the ST board and I get this on kernel log

[   95.976488] usb 1-1.1.2: new full-speed USB device number 6 using dwc_otg
[   96.120102] usb 1-1.1.2: New USB device found, idVendor=0483, idProduct=374b, bcdDevice= 1.00
[   96.120117] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   96.120126] usb 1-1.1.2: Product: STM32 STLink
[   96.120136] usb 1-1.1.2: Manufacturer: STMicroelectronics
[   96.120145] usb 1-1.1.2: SerialNumber: 066BFF535156827867092537
[   96.176926] usb-storage 1-1.1.2:1.1: USB Mass Storage device detected
[   96.178567] scsi host0: usb-storage 1-1.1.2:1.1
[   97.153381] cdc_acm 1-1.1.2:1.2: ttyACM0: USB ACM device
[   97.154368] usbcore: registered new interface driver cdc_acm
[   97.154376] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[   97.154814] usbcore: registered new interface driver uas
[   97.197089] ERROR::assign_and_init_hc:1437: assign_and_init_hc: Failed to allocate memory to handle non-dword aligned buffer case
[  107.359472] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 4
[  107.360617] scsi 0:0:0:0: Direct-Access     MBED     microcontroller  1.0  PQ: 0 ANSI: 2
[  107.362407] sd 0:0:0:0: [sda] 4168 512-byte logical blocks: (2.13 MB/2.04 MiB)
[  107.363152] sd 0:0:0:0: [sda] Write Protect is off
[  107.363165] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[  107.363781] sd 0:0:0:0: [sda] No Caching mode page found
[  107.363792] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  107.394145] sd 0:0:0:0: [sda] Attached SCSI removable disk
[  114.696136] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  144.161596] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  149.201516] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 7
[  155.281561] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 1
[  155.281598] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  161.281272] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 0
[  161.281308] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  167.600657] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 5
[  167.600698] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  180.559753] WARN::dwc_otg_hcd_urb_dequeue:639: Timed out waiting for FSM NP transfer to complete on 2
[  180.559799] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  183.439158] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  195.998572] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  198.798402] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  195.998572] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  198.798402] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  203.038248] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  208.078063] cdc_acm 1-1.1.2:1.2: failed to set dtr/rts
[  209.118026] usb 1-1.1-port2: cannot reset (err = -110)
[  210.157991] usb 1-1.1-port2: cannot reset (err = -110)
[  211.197915] usb 1-1.1-port2: cannot reset (err = -110)
[  212.237909] usb 1-1.1-port2: cannot reset (err = -110)
[  213.277883] usb 1-1.1-port2: cannot reset (err = -110)
[  213.277892] usb 1-1.1-port2: Cannot enable. Maybe the USB cable is bad?
[  214.317847] usb 1-1.1-port2: cannot disable (err = -110)
[  215.357779] usb 1-1.1-port2: cannot reset (err = -110)
[  216.077767] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  216.397747] usb 1-1.1-port2: cannot reset (err = -110)
[  217.437757] usb 1-1.1-port2: cannot reset (err = -110)
[  218.477734] usb 1-1.1-port2: cannot reset (err = -110)
[  219.517705] usb 1-1.1-port2: cannot reset (err = -110)
[  219.517717] usb 1-1.1-port2: Cannot enable. Maybe the USB cable is bad?
[  220.557674] usb 1-1.1-port2: cannot disable (err = -110)
[  221.597606] usb 1-1.1-port2: cannot reset (err = -110)
[  222.637585] usb 1-1.1-port2: cannot reset (err = -110)
[  223.677583] usb 1-1.1-port2: cannot reset (err = -110)
[  224.717559] usb 1-1.1-port2: cannot reset (err = -110)
[  225.757574] usb 1-1.1-port2: cannot reset (err = -110)
[  225.757589] usb 1-1.1-port2: Cannot enable. Maybe the USB cable is bad?
[  226.797535] usb 1-1.1-port2: cannot disable (err = -110)
[  227.837570] usb 1-1.1-port2: cannot reset (err = -110)
[  228.877558] usb 1-1.1-port2: cannot reset (err = -110)
[  229.917443] usb 1-1.1-port2: cannot reset (err = -110)
[  230.957427] usb 1-1.1-port2: cannot reset (err = -110)
[  231.997418] usb 1-1.1-port2: cannot reset (err = -110)
[  231.997430] usb 1-1.1-port2: Cannot enable. Maybe the USB cable is bad?
[  233.037367] usb 1-1.1-port2: cannot disable (err = -110)
[  234.077317] usb 1-1.1-port2: cannot disable (err = -110)
[  234.078967] VFS: busy inodes on changed media or resized disk sda
[  235.917313] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  239.277257] hub 1-1.1:1.0: hub_ext_port_status failed (err = -110)
[  251.276975] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  269.836713] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  289.676527] lan78xx 1-1.1.1:1.0 eth0: Failed to read stat ret = -110
[  302.076828] ------------[ cut here ]------------
[  302.076859] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:466 dev_watchdog+0x298/0x29c
[  302.076867] NETDEV WATCHDOG: eth0 (lan78xx): transmit queue 0 timed out
[  302.076872] Modules linked in: sg uas cdc_acm 88x2bu(O) cmac bnep hci_uart btbcm serdev bluetooth ecdh_generic 8021q garp stp llc xt_state xt_conntrack nft_counter nft_chain_nat_ipv4 ipt_MASQUERADE nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nft_compat nf_tables nfnetlink brcmfmac brcmutil cfg80211 rfkill raspberrypi_hwmon hwmon bcm2835_codec(C) v4l2_mem2mem bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) v4l2_common videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev media vc_sm_cma(C) uio_pdrv_genirq uio fixed ip_tables x_tables ipv6
[  302.077055] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G         C O      4.19.118-v7-bellwethercoffee #1
[  302.077060] Hardware name: BCM2835
[  302.077089] [<80112018>] (unwind_backtrace) from [<8010d364>] (show_stack+0x20/0x24)
[  302.077108] [<8010d364>] (show_stack) from [<808513f4>] (dump_stack+0xd8/0x11c)
[  302.077128] [<808513f4>] (dump_stack) from [<80120c00>] (__warn.part.3+0xcc/0xe8)
[  302.077144] [<80120c00>] (__warn.part.3) from [<80120c94>] (warn_slowpath_fmt+0x78/0x94)
[  302.077159] [<80120c94>] (warn_slowpath_fmt) from [<80777c74>] (dev_watchdog+0x298/0x29c)
[  302.077176] [<80777c74>] (dev_watchdog) from [<80199688>] (call_timer_fn+0x3c/0x1a4)
[  302.077191] [<80199688>] (call_timer_fn) from [<801998e8>] (expire_timers+0xf8/0x168)
[  302.077205] [<801998e8>] (expire_timers) from [<80199a0c>] (run_timer_softirq+0xb4/0x1e4)
[  302.077220] [<80199a0c>] (run_timer_softirq) from [<801023f8>] (__do_softirq+0x188/0x410)
[  302.077237] [<801023f8>] (__do_softirq) from [<80126c48>] (irq_exit+0xf8/0x134)
[  302.077253] [<80126c48>] (irq_exit) from [<8018092c>] (__handle_domain_irq+0x70/0xc4)
[  302.077269] [<8018092c>] (__handle_domain_irq) from [<801021a0>] (bcm2836_arm_irqchip_handle_irq+0x60/0xa8)
[  302.077283] [<801021a0>] (bcm2836_arm_irqchip_handle_irq) from [<801019bc>] (__irq_svc+0x5c/0x7c)
[  302.077290] Exception stack(0x80d01ed8 to 0x80d01f20)
[  302.077298] 1ec0:                                                       80109ab4 00000000
[  302.077311] 1ee0: 40000093 40000093 ffffe000 80d04d70 80d04db8 00000001 00000001 80d8f9fe
[  302.077323] 1f00: 80a76f10 80d01f34 80d00000 80d01f28 00000000 80109ab8 40000013 ffffffff
[  302.077340] [<801019bc>] (__irq_svc) from [<80109ab8>] (arch_cpu_idle+0x34/0x4c)
[  302.077358] [<80109ab8>] (arch_cpu_idle) from [<8086cf40>] (default_idle_call+0x40/0x48)
[  302.077378] [<8086cf40>] (default_idle_call) from [<80152d10>] (do_idle+0x124/0x164)
[  302.077398] [<80152d10>] (do_idle) from [<80153010>] (cpu_startup_entry+0x28/0x2c)
[  302.077414] [<80153010>] (cpu_startup_entry) from [<808665e4>] (rest_init+0xb8/0xbc)
[  302.077431] [<808665e4>] (rest_init) from [<80c00fdc>] (start_kernel+0x48c/0x4b4)
[  302.077451] ---[ end trace 915044b1c39e3311 ]---

Afer this, network interfaces (ethernet, onboard wifi) are unusable.

Expected behaviour
Kernel recognize WiFi dongle and ST board both connected at the same time an at boot, as it was the case on kernel 4.14.114

Actual behaviour
No working with both devices connected only one at a time

System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

  • Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
    Pi3B+
  • Which OS and version (cat /etc/rpi-issue)?
    Raspbian 10 (buster)
  • Which firmware version (vcgencmd version)?
    version 82f9bb929ce2186eb1824178c1ae82902ad6275c (clean) (release) (start)
  • Which kernel version (uname -a)?
    Linux gray-jolly-donkey 4.19.118-v7 #1 SMP Wed Jul 15 14:45:22 PDT 2020 armv7l GNU/Linux and
    Linux gray-jolly-donkey 5.4.51-v7 #1 SMP Wed Jul 15 14:45:22 PDT 2020 armv7l GNU/Linux
@xyklex
Copy link
Author

xyklex commented Jul 16, 2020

don't know if is related to #2924

@xyklex
Copy link
Author

xyklex commented Jul 16, 2020

Ok it looks like I hadn't researched well into the existing issues but adding coherent_pool=4M to bootargs fixed the issue, and now both devices can work together.

@xyklex xyklex closed this as completed Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant