2022-03-08 23:47:12

by Zheyu Ma

[permalink] [raw]
Subject: [BUG] scsi: sym53c8xx_2: warning in ___free_dma_mem_cluster()

Hi,

I found a bug when proing the sym53c8xx driver.

When the initialization process fails on sym_find_frimware(), the
driver frees the related resources, which cause a warning in kernel.

The following log reveals it:

[ 3.736968] WARNING: CPU: 6 PID: 1 at kernel/dma/mapping.c:528
dma_free_attrs+0xf1/0x110
[ 3.737503] Modules linked in:
[ 3.737503] CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.16.0-rc1+ #31
[ 3.737503] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009),
BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
[ 3.737503] RIP: 0010:dma_free_attrs+0xf1/0x110
[ 3.737503] Call Trace:
[ 3.737503] <TASK>
[ 3.737503] ___free_dma_mem_cluster+0x18e/0x6a0
[ 3.737503] __sym_mfree_dma+0x2ec/0x740
[ 3.737503] sym_hcb_free+0x147/0x6e0
[ 3.737503] sym_attach+0xec1/0x1380
[ 3.737503] sym2_probe+0x852/0xab0
[ 3.737503] ? sym_log_bus_error+0x140/0x140
[ 3.737503] local_pci_probe+0x13f/0x210
[ 3.737503] pci_device_probe+0x34c/0x6d0
[ 3.737503] ? pci_uevent+0x470/0x470
[ 3.737503] really_probe+0x24c/0x8d0
[ 3.737503] __driver_probe_device+0x1b3/0x280
[ 3.737503] driver_probe_device+0x50/0x380
[ 3.737503] __driver_attach+0x416/0x580
[ 3.737503] ? driver_attach+0x40/0x40
[ 3.737503] bus_for_each_dev+0x10d/0x160
[ 3.737503] bus_add_driver+0x2f7/0x520
[ 3.737503] driver_register+0x2e9/0x3e0
[ 3.737503] sym2_init+0x16a/0x1fa
[ 3.737503] ? pqi_init+0x174/0x174
[ 3.737503] do_one_initcall+0x10c/0x260
[ 3.737503] ? pqi_init+0x174/0x174
[ 3.737503] ? do_initcall_level+0x133/0x133
[ 3.737503] ? parse_args+0x19e/0x940
[ 3.737503] ? lock_is_held_type+0xe2/0x140
[ 3.737503] do_initcall_level+0x103/0x133
[ 3.737503] do_initcalls+0x46/0x76
[ 3.737503] kernel_init_freeable+0x292/0x396
[ 3.737503] ? rest_init+0x240/0x240
[ 3.737503] kernel_init+0x14/0x1b0
[ 3.737503] ? rest_init+0x240/0x240
[ 3.737503] ret_from_fork+0x22/0x30

Regards,
Zheyu Ma