This patch fixes an issue where, if a MEN Chameleon device is not
supported, the early exit in chameleon_parse_gdd() will end up
calling put_device() when no device has been initialized yet. Because
the MCB subsystem does not support all the possible chameleon devices
listed for one FPGA, dmesg gets a few of these when parsing a Chameleon
FPGA:
[ 32.974385] No BAR for 16z024
[ 32.974386] ------------[ cut here ]------------
[ 32.974388] kobject: '(null)' (000000002644a89d): is not initialized, yet kobject_put() is being called.
[ 32.974403] WARNING: CPU: 0 PID: 103 at lib/kobject.c:726 kobject_put+0x52/0xa0
[ 32.974410] Modules linked in: mcb_pci(+) intel_cstate mcb acpi_pad mac_hid mxm_wmi sch_fq_codel ipmi_devintf ipmi_msghandler msr parport_pc ppdev lp parport pstore_blk drm ramoops pstore_zone efi_pstore reed_solomon ip_tables x_tables autofs4 uas usb_storage spi_intel_platform spi_intel gpio_ich ixgbe igb i2c_i801 xhci_pci i2c_algo_bit xfrm_algo crc32_pclmul e1000e i2c_smbus lpc_ich xhci_pci_renesas dca mdio wmi
[ 32.974455] CPU: 0 PID: 103 Comm: kworker/0:3 Tainted: G W 6.2.0-32-generic #32~22.04.1-Ubuntu
[ 32.974458] Hardware name: MEN Mikro Elektronik GmbH G25A/n/a, BIOS 1.01 01/31/2017
[ 32.974460] Workqueue: events work_for_cpu_fn
[ 32.974467] RIP: 0010:kobject_put+0x52/0xa0
[ 32.974472] Code: 74 39 85 c0 7e 4f 4c 8b 65 f8 c9 31 c0 31 d2 31 f6 31 ff c3 cc cc cc cc 48 8b 37 48 89 fa 48 c7 c7 48 69 65 98 e8 2e ae 0e ff <0f> 0b eb be 31 c0 31 d2 31 f6 31 ff c3 cc cc cc cc 4c 89 e7 e8 05
[ 32.974475] RSP: 0000:ffff9a0600597d48 EFLAGS: 00010246
[ 32.974478] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 32.974480] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 32.974481] RBP: ffff9a0600597d50 R08: 0000000000000000 R09: 0000000000000000
[ 32.974483] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8bab960c3800
[ 32.974486] R13: 0000000000000000 R14: 0000000000004000 R15: ffff8bab95895c00
[ 32.974488] FS: 0000000000000000(0000) GS:ffff8bb2dfc00000(0000) knlGS:0000000000000000
[ 32.974491] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 32.974493] CR2: 00007f7e688fdf3e CR3: 000000011007c003 CR4: 00000000003706f0
[ 32.974496] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 32.974498] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 32.974500] Call Trace:
[ 32.974501] <TASK>
[ 32.974503] ? show_regs+0x72/0x90
[ 32.974507] ? kobject_put+0x52/0xa0
[ 32.974512] ? __warn+0x8d/0x160
[ 32.974518] ? kobject_put+0x52/0xa0
[ 32.974523] ? report_bug+0x1bb/0x1d0
[ 32.974530] ? handle_bug+0x46/0x90
[ 32.974536] ? exc_invalid_op+0x19/0x80
[ 32.974542] ? asm_exc_invalid_op+0x1b/0x20
[ 32.974547] ? kobject_put+0x52/0xa0
[ 32.974552] ? kobject_put+0x52/0xa0
[ 32.974557] put_device+0x13/0x30
[ 32.974563] chameleon_parse_gdd+0x149/0x1d0 [mcb]
[ 32.974573] ? chameleon_get_bar+0xc2/0xf0 [mcb]
[ 32.974583] chameleon_parse_cells+0x196/0x1c4 [mcb]
[ 32.974593] mcb_pci_probe+0xf5/0x280 [mcb_pci]
[ 32.974602] local_pci_probe+0x4b/0xb0
[ 32.974607] work_for_cpu_fn+0x1a/0x30
[ 32.974613] process_one_work+0x21f/0x440
[ 32.974618] worker_thread+0x200/0x3f0
[ 32.974623] ? __pfx_worker_thread+0x10/0x10
[ 32.974627] kthread+0xee/0x120
[ 32.974633] ? __pfx_kthread+0x10/0x10
[ 32.974639] ret_from_fork+0x2c/0x50
[ 32.974644] </TASK>
[ 32.974646] ---[ end trace 0000000000000000 ]---
This error was introduced in commit:
commit 728ac3389296 ("mcb: mcb-parse: fix error handing in chameleon_parse_gdd()")
Jorge Sanjuan Garcia (1):
mcb: fix error handling for different scenarios when parsing
drivers/mcb/mcb-core.c | 1 +
drivers/mcb/mcb-parse.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--
2.34.1