On Sat, May 25, 2024 at 3:19 PM Li Nan <linan666@xxxxxxxxxxxxxxx> wrote: > > > > 在 2024/5/24 17:45, Li Nan 写道: > > > > > > 在 2024/5/24 11:49, Changhui Zhong 写道: > >> Hello, > >> > >> I hit the kernel panic when running test ubdsrv generic/005, > >> please help check it and let me know if you need any info/testing for > >> it, thanks. > >> > > Can you test the following patch? WARN will still be triggered, but the > NULL pointer dereference will be fixed. > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > index 4e159948c912..99b621b2d40f 100644 > --- a/drivers/block/ublk_drv.c > +++ b/drivers/block/ublk_drv.c > @@ -2630,7 +2630,8 @@ static void ublk_queue_reinit(struct ublk_device *ub, > struct ublk_queue *ubq) > { > int i; > > - WARN_ON_ONCE(!(ubq->ubq_daemon && ubq_daemon_is_dying(ubq))); > + if (WARN_ON_ONCE(!(ubq->ubq_daemon && ubq_daemon_is_dying(ubq)))) > + return; > > /* All old ioucmds have to be completed */ > ubq->nr_io_ready = 0; > > -- > Thanks, > Nan > Hi,Nan Thanks for your patch, as you said, after applying your patch, the "NULL pointer dereference" has been fixed, and only triggered the warning. [ 6965.073785] ------------[ cut here ]------------ [ 6965.078414] WARNING: CPU: 0 PID: 86434 at drivers/block/ublk_drv.c:2633 ublk_ctrl_start_recovery.constprop.0+0x60/0x1a0 [ 6965.089192] Modules linked in: ext4 mbcache jbd2 loop tls rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace netfs rfkill sunrpc vfat fat dm_multipath ipmi_ssif intel_rapl_msr intel_rapl_common intel_uncore_frequency intel_uncore_frequency_common i10nm_edac nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm mgag200 rapl dax_hmem i2c_algo_bit cxl_acpi intel_cstate drm_shmem_helper iTCO_wdt cxl_core iTCO_vendor_support acpi_power_meter dcdbas mei_me drm_kms_helper dell_smbios intel_th_gth intel_uncore pcspkr einj i2c_i801 ipmi_si dell_wmi_descriptor wmi_bmof isst_if_mmio isst_if_mbox_pci mei intel_th_pci acpi_ipmi isst_if_common intel_pch_thermal intel_vsec intel_th i2c_smbus ipmi_devintf ipmi_msghandler drm fuse xfs libcrc32c sd_mod t10_pi sg ahci crct10dif_pclmul crc32_pclmul libahci crc32c_intel libata tg3 ghash_clmulni_intel wmi dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 6965.171508] CPU: 0 PID: 86434 Comm: iou-wrk-86420 Not tainted 6.10.0-rc1+ #1 [ 6965.178555] Hardware name: Dell Inc. PowerEdge R650xs/0PPTY2, BIOS 1.4.4 10/07/2021 [ 6965.186206] RIP: 0010:ublk_ctrl_start_recovery.constprop.0+0x60/0x1a0 [ 6965.192645] Code: 85 48 01 00 00 66 41 83 7c 24 1c 02 0f 85 3b 01 00 00 66 41 83 7c 24 18 00 0f 84 b8 00 00 00 45 31 ed 41 be ff ff ff ff eb 15 <0f> 0b 41 0f b7 44 24 18 41 83 c5 01 41 39 c5 0f 8d 98 00 00 00 44 [ 6965.211390] RSP: 0018:ff5798fa0e1f7ce0 EFLAGS: 00010246 [ 6965.216617] RAX: 0000000000000002 RBX: ff43a5a306a28000 RCX: 0000000000000000 [ 6965.223750] RDX: ff43a5a313e82040 RSI: ffffffff84c4ee00 RDI: 0000000000000000 [ 6965.230884] RBP: ff43a5a313956c68 R08: 0000000000000000 R09: ffffffff850e35e0 [ 6965.238016] R10: 0000000000000000 R11: 0000000000000000 R12: ff43a5a313956800 [ 6965.245149] R13: 0000000000000000 R14: 00000000ffffffff R15: ff43a5a30b9ec080 [ 6965.252281] FS: 00007fc05ee44740(0000) GS:ff43a5a66f600000(0000) knlGS:0000000000000000 [ 6965.260366] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 6965.266115] CR2: 00007f92f07fca50 CR3: 0000000113266006 CR4: 0000000000771ef0 [ 6965.273246] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 6965.280378] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 6965.287510] PKRU: 55555554 [ 6965.290225] Call Trace: [ 6965.292678] <TASK> [ 6965.294783] ? __warn+0x7f/0x120 [ 6965.298015] ? ublk_ctrl_start_recovery.constprop.0+0x60/0x1a0 [ 6965.303850] ? report_bug+0x18a/0x1a0 [ 6965.307514] ? handle_bug+0x3c/0x70 [ 6965.311008] ? exc_invalid_op+0x14/0x70 [ 6965.314846] ? asm_exc_invalid_op+0x16/0x20 [ 6965.319032] ? ublk_ctrl_start_recovery.constprop.0+0x60/0x1a0 [ 6965.324865] ublk_ctrl_uring_cmd+0x4f7/0x6c0 [ 6965.329138] ? pick_next_task_idle+0x26/0x40 [ 6965.333412] io_uring_cmd+0x9a/0x1b0 [ 6965.336991] io_issue_sqe+0x18f/0x3f0 [ 6965.340655] io_wq_submit_work+0x9b/0x390 [ 6965.344671] io_worker_handle_work+0x165/0x360 [ 6965.349114] io_wq_worker+0xcb/0x2f0 [ 6965.352694] ? finish_task_switch.isra.0+0x203/0x290 [ 6965.357659] ? finish_task_switch.isra.0+0x203/0x290 [ 6965.362628] ? __pfx_io_wq_worker+0x10/0x10 [ 6965.366814] ret_from_fork+0x2d/0x50 [ 6965.370402] ? __pfx_io_wq_worker+0x10/0x10 [ 6965.374587] ret_from_fork_asm+0x1a/0x30 [ 6965.378513] </TASK> [ 6965.380704] ---[ end trace 0000000000000000 ]--- Thanks, Changhui