KASAN reports as fllowing:
[ 478.962411] Call trace: [ 478.962450] device_remove_properties+0x6c/0xb4 [ 478.962457] device_del+0x2d8/0x660 [ 478.962465] pci_remove_bus_device+0xc4/0x1a0 [ 478.962470] pci_stop_and_remove_bus_device+0x94/0xb0 [ 478.962477] pci_iov_remove_virtfn+0x160/0x210 [ 478.962481] sriov_disable+0x70/0x1ac [ 478.962486] pci_disable_sriov+0x34/0x44
[ 478.964837] Allocated by task 10258: [ 478.969197] kmem_cache_alloc_trace+0xe0/0x570 [ 478.969204] swnode_register+0x54/0x310 [ 478.969208] fwnode_create_software_node+0xf8/0x130 [ 478.969215] device_add_properties+0x28/0x50 [ 478.969221] quirk_huawei_pcie_sva+0x12c/0x14c [ 478.969225] pci_do_fixups+0x120/0x1b0 [ 478.969229] pci_fixup_device+0x4c/0x140 [ 478.969233] pci_bus_add_device+0x2c/0xd4 [ 478.969237] pci_iov_add_virtfn+0x470/0x49c [ 478.969241] sriov_enable+0x368/0x690 [ 478.969246] pci_enable_sriov+0x3c/0x54
[ 478.971557] Freed by task 10258: [ 478.975570] kfree+0xe4/0x6b0 [ 478.975574] software_node_release+0xf4/0x16c [ 478.975578] kobject_cleanup+0x158/0x1a8 [ 478.975582] kobject_put.part.0+0x9c/0xf4 [ 478.975587] kobject_put+0x18/0x24 [ 478.975591] software_node_notify+0xe8/0x1a0 [ 478.975595] device_platform_notify+0x54/0xc0 [ 478.975599] device_del+0x2c8/0x660 [ 478.975603] pci_remove_bus_device+0xc4/0x1a0 [ 478.975607] pci_stop_and_remove_bus_device+0x94/0xb0 [ 478.975612] pci_iov_remove_virtfn+0x160/0x210
device_add() should be called after device_add_properties(), address this issue by replacing device_add_properties() with device_create_managed_software_node().
Heikki Krogerus (2): [Backport] software node: Provide replacement for device_add_properties() [Backport] PCI: Convert to device_create_managed_software_node()
drivers/base/swnode.c | 43 ++++++++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 2 +- include/linux/property.h | 4 ++++ 3 files changed, 48 insertions(+), 1 deletion(-)