BUG: kernel NULL pointer dereference, address

Hey

When i disconnect my nRF5340-DK devkit to my Lenovo T14s Gen 2 running Ubuntu 20.04.3 LTS the usb driver in the linux kernel crashes.

I think it's a problem that have occurred after i have installed updates to ubuntu. But when it started happening i dont know.

When i look at dmesg i get the following errors when disconnecting the board:

[ 31.530202] usb 3-7: new full-speed USB device number 6 using xhci_hcd
[ 31.680972] usb 3-7: New USB device found, idVendor=1366, idProduct=1055, bcdDevice= 1.00
[ 31.680979] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 31.680980] usb 3-7: Product: J-Link
[ 31.680982] usb 3-7: Manufacturer: SEGGER
[ 31.680983] usb 3-7: SerialNumber: 000960144976
[ 32.229387] cdc_acm 3-7:1.0: ttyACM0: USB ACM device
[ 32.229744] cdc_acm 3-7:1.2: ttyACM1: USB ACM device
[ 32.229995] cdc_acm 3-7:1.4: ttyACM2: USB ACM device
[ 32.230047] usbcore: registered new interface driver cdc_acm
[ 32.230048] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 32.235853] usb-storage 3-7:1.7: USB Mass Storage device detected
[ 32.235961] scsi host0: usb-storage 3-7:1.7
[ 32.236041] usbcore: registered new interface driver usb-storage
[ 32.237626] usbcore: registered new interface driver uas
[ 33.247375] scsi 0:0:0:0: Direct-Access SEGGER MSD Volume 1.00 PQ: 0 ANSI: 4
[ 33.247938] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 33.251170] sd 0:0:0:0: [sda] 21829 512-byte logical blocks: (11.2 MB/10.7 MiB)
[ 33.253496] sd 0:0:0:0: [sda] Write Protect is off
[ 33.253503] sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08
[ 33.255489] sd 0:0:0:0: [sda] No Caching mode page found
[ 33.255509] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 33.277779] sda:
[ 33.303314] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 37.903846] usb 3-7: USB disconnect, device number 6
[ 37.908216] BUG: kernel NULL pointer dereference, address: 0000000000000030
[ 37.908226] #PF: supervisor read access in kernel mode
[ 37.908231] #PF: error_code(0x0000) - not-present page
[ 37.908236] PGD 0 P4D 0
[ 37.908243] Oops: 0000 [#1] SMP NOPTI
[ 37.908250] CPU: 6 PID: 339 Comm: kworker/6:2 Kdump: loaded Not tainted 5.14.0-1023-oem #25-Ubuntu
[ 37.908258] Hardware name: LENOVO 20WM00B7MX/20WM00B7MX, BIOS N35ET43W (1.43 ) 12/14/2021
[ 37.908263] Workqueue: usb_hub_wq hub_event
[ 37.908276] RIP: 0010:blk_mq_cancel_work_sync+0x5/0x60
[ 37.908291] Code: 94 41 2b 5d 48 49 8d bf e0 03 00 00 89 45 d0 89 de e8 9f 1b 07 00 8b 45 d0 e9 77 ff ff ff b8 ea ff ff ff eb 98 0f 1f 44 00 00 <48> 83 7f 30 00 74 45 55 48 89 e5 41 54 49 89 fc 48 8d bf 68 05 00
[ 37.908298] RSP: 0018:fffface1003d7908 EFLAGS: 00010293
[ 37.908305] RAX: 0000000000000000 RBX: ffff8bda05613a00 RCX: 0000000000004e01
[ 37.908311] RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000000
[ 37.908316] RBP: fffface1003d7920 R08: ffffffff9b5581c0 R09: ffff8bda31d20b68
[ 37.908320] R10: 0000000000000000 R11: ffff8bda31d20b90 R12: ffff8bdae12c7240
[ 37.908325] R13: 0000000000000000 R14: ffff8bdae12c7240 R15: 0000000000000000
[ 37.908330] FS: 0000000000000000(0000) GS:ffff8be13f700000(0000) knlGS:0000000000000000
[ 37.908336] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 37.908342] CR2: 0000000000000030 CR3: 0000000106480002 CR4: 0000000000770ee0
[ 37.908347] PKRU: 55555554
[ 37.908350] Call Trace:
[ 37.908353] <TASK>
[ 37.908356] ? disk_release+0x38/0x90
[ 37.908366] device_release+0x38/0xa0
[ 37.908376] kobject_release+0x45/0x150
[ 37.908383] kobject_put+0x49/0x60
[ 37.908388] put_device+0x13/0x20
[ 37.908394] put_disk+0x1b/0x20
[ 37.908399] sg_device_destroy+0x54/0x90
[ 37.908407] sg_remove_device+0x128/0x170
[ 37.908414] device_del+0x12d/0x3f0
[ 37.908418] device_unregister+0x18/0x60
[ 37.908422] __scsi_remove_device+0x110/0x150
[ 37.908434] scsi_forget_host+0x5f/0x70
[ 37.908441] scsi_remove_host+0x77/0x110
[ 37.908455] usb_stor_disconnect+0x50/0xd0 [usb_storage]
[ 37.908470] usb_unbind_interface+0x89/0x260
[ 37.908480] device_release_driver_internal+0x100/0x1d0
[ 37.908490] device_release_driver+0x12/0x20
[ 37.908499] bus_remove_device+0xde/0x150
[ 37.908505] device_del+0x192/0x3f0
[ 37.908509] ? usb_remove_ep_devs+0x1f/0x30
[ 37.908516] usb_disable_device+0x95/0x1b0
[ 37.908526] usb_disconnect+0xc0/0x270
[ 37.908534] hub_port_connect+0x81/0x8c0
[ 37.908544] port_event+0x57f/0x860
[ 37.908554] hub_event+0x152/0x3b0
[ 37.908563] process_one_work+0x21d/0x3c0
[ 37.908574] worker_thread+0x4d/0x3f0
[ 37.908580] ? process_one_work+0x3c0/0x3c0
[ 37.908586] kthread+0x127/0x150
[ 37.908591] ? set_kthread_struct+0x40/0x40
[ 37.908596] ret_from_fork+0x1f/0x30
[ 37.908606] </TASK>
[ 37.908609] Modules linked in: uas usb_storage cdc_acm rfcomm ccm cmac algif_hash algif_skcipher af_alg snd_ctl_led snd_soc_skl_hda_dsp snd_soc_intel_hda_dsp_common snd_soc_hdac_hdmi snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_nat iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink ip6table_filter ip6_tables iptable_filter bpfilter bridge stp llc bnep uvcvideo videobuf2_vmalloc videobuf2_memops btusb videobuf2_v4l2 btrtl videobuf2_common btbcm btintel videodev bluetooth mc ecdh_generic ecc intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp snd_soc_dmic coretemp mei_hdcp intel_rapl_msr binfmt_misc nls_iso8859_1 snd_sof_pci_intel_tgl snd_sof_intel_hda_common kvm_intel soundwire_intel soundwire_generic_allocation soundwire_cadence kvm snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp crct10dif_pclmul ghash_clmulni_intel
[ 37.908724] snd_sof snd_soc_hdac_hda snd_hda_ext_core snd_soc_acpi_intel_match aesni_intel snd_soc_acpi soundwire_bus crypto_simd snd_seq_midi snd_soc_core joydev cryptd snd_compress snd_seq_midi_event intel_cstate i915 ac97_bus snd_pcm_dmaengine snd_rawmidi snd_hda_intel iwlmvm snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core mac80211 snd_hwdep ttm libarc4 snd_seq snd_pcm think_lmi drm_kms_helper input_leds snd_seq_device serio_raw efi_pstore snd_timer firmware_attributes_class thinkpad_acpi cec iwlwifi rc_core wmi_bmof nvram ucsi_acpi processor_thermal_device_pci_legacy processor_thermal_device i2c_algo_bit platform_profile processor_thermal_rfim ledtrig_audio processor_thermal_mbox processor_thermal_rapl fb_sys_fops mei_me typec_ucsi hid_multitouch intel_rapl_common syscopyarea cfg80211 mei intel_soc_dts_iosf sysfillrect sysimgblt typec igen6_edac snd soundcore int3403_thermal int340x_thermal_zone mac_hid acpi_tad int3400_thermal intel_hid sparse_keymap
[ 37.908824] acpi_thermal_rel acpi_pad sch_fq_codel msr drm ip_tables x_tables autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_generic crc32_pclmul e1000e i2c_i801 nvme intel_lpss_pci i2c_smbus intel_lpss idma64 nvme_core thunderbolt xhci_pci xhci_pci_renesas wmi i2c_hid_acpi i2c_hid hid video pinctrl_tigerlake
[ 37.908894] CR2: 0000000000000030

  • Hi,

    The Linux USB driver crashing on removing a USB device sounds like a Linux USB driver issue. It is hard to tell from our end what might be the issue there, and we are not able to reproduce locally using the same Ubuntu distribution. If you haven't done so already, I recommend checking with Linux and/or Ubuntu forums / support in order to figure out what is the issue, or if it is a driver provided and supported by a hardware manufacturer contact them about the issue.

    From our side, one thing you could try is use J-Link Commander and issue the command "MSDDisable", for disabling the Mass Storage Device functionality of the SEGGER interface MCU. If the driver issue is in any way related to the MSD functionality, then that might provide a workaround. The MSD functionality is not used for any of the standard workflows when working with nRF devices.

    Regards,
    Terje

  • Hey

    I actually have tried to disable MSDDisable and it does not seems to be the problem.

    I have also raised the same bug at Lenovo. I have also tried to submit the bug to Ubuntu but that was easier said than done and i dont know if i have submitted it correctly.

  • Hi,

    Thanks for the update. Too bad the MSD workaround doesn't work. We have multiple users of the same version of Ubuntu in-house, and do not see the issue here, which does point in the direction of the specific hardware of your laptop in combination with the given driver.

    One final thought: Have you added (or briefly used) any other USB devices to your system lately, that can somehow have led to a conflict?

    Regards,
    Terje

  • Its a laptop so i did the test without anything connected

Related